Repository navigation
[v0.2] Build for Windows behind the platform seam - #36
Merged
Merged
Conversation
The seam gains a Windows arm: %USERPROFILE%\.line, ssh.exe discovery, %ProgramData% system policy with the NUL device, no POSIX mode bits, no POSIX signals, and taskkill for child trees. Saved passwords are refused because Windows OpenSSH has no SSH_ASKPASS, and the confirmation wait and shutdown registration no longer assume POSIX. Refs #35, #30 Signed-off-by: Xingqiu Xu <hilbertanjou83@gmail.com>
3 tasks
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parent: #1
Closes #35
Advances #30 — the platform implementation and its build story. Windows CI legs, release artifacts, and the README entry follow in the next PR, so #30 stays open.
What changed
Platform seam (
src/platform.rs)%USERPROFILE%\.line, still overridable withLINE_CONFIG_DIRssh.exe/ssh-keygen.exefromPATH%ProgramData%\ssh\ssh_configwhen present, otherwiseNUL— the user's own.ssh\configstill cannot redefine a profiletaskkill /PID <pid> /T /FRuntime (#35)
wait_for_terminal_linekeeps the Unixpollimplementation and gains a Windows arm that asks the console for input events every 250 ms. Both paths check the shutdown flag on the same cadence, and a new portable test pins the shutdown contract.SHUTDOWN_SIGNALSlist:SIGTERM,SIGHUP,SIGINT,SIGQUITon Unix;SIGTERM,SIGINT,SIGBREAKon Windows, which is what console close, Ctrl-C, and Ctrl-Break actually deliver.Saved passwords
SSH_ASKPASSdoes not exist in Windows OpenSSH, soconnectrefuses a password profile withSshError::SavedPasswordsUnsupportedbefore spawning anything, and the platform seam exposessupports_saved_passwords()so the decision is stated once. Windows CI covers the refusal.File identity
same_fileis now path-based. Unix keeps the device/inode comparison; Windows needs the file-handle API, whichstdhas not stabilised (windows_by_handle), so the Windows arm uses thesame-filecrate — declared as a Windows-only dependency, keeping it out of the Linux and macOS dependency graphs. The mirrors/usage logic was reordered to compare identities before the canonical files are deleted, which the existing key-store test caught.Test scaffolding
The fake OpenSSH programs are POSIX shell scripts, so the tests that depend on them are now
#[cfg(unix)]. Windows still runs the portable half, and the platform-specific tests added here run on both.Verification
cargo check --all-targets --lockedforx86_64-pc-windows-msvc,aarch64-pc-windows-msvc,aarch64-apple-darwin, and the host — all clean, includingcargo +1.88.0 check --target x86_64-pc-windows-msvc.cargo clippy --all-targets --all-features -- -D warningsfor Windows and the host.cargo test --all-targets --lockedon Linux: 124 lib tests plus every integration suite.cargo fmt --check.The real Windows evidence arrives with the CI legs in the follow-up PR; this one proves the code compiles and the portable behaviour still holds.