Skip to content

Commit 09cd90d

Browse files
samkeenclaude
andcommitted
Skip Unix-only attach tests on Windows
Two new settings tests — cli_layer_ok_when_attached_to_live_process and attached_pid_for_live_process_resolves_project_root — assert that attaching to a live pid resolves to Some(...). But process_for_pid is Unix-only in v1 (sysinfo doesn't expose another process's environ on Windows, so the function early-returns None on that target). Add the same cfg!(target_os = "windows") early-return guard used by current_uid_resolves_on_unix. The Windows code path is still covered by the existing tests that exercise the None branch (attached_pid_for_unknown_process_emits_diagnostic runs on every OS). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f49836c commit 09cd90d

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

src-tauri/src/settings.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,13 @@ mod tests {
872872

873873
#[test]
874874
fn cli_layer_ok_when_attached_to_live_process() {
875+
// sysinfo can't read another process's environ on Windows; attach
876+
// mode reports `Unsupported` and `process_for_pid` returns None,
877+
// so an "attached" snapshot has no argv to parse and the cli
878+
// layer stays Missing. The test's premise only holds on Unix.
879+
if cfg!(target_os = "windows") {
880+
return;
881+
}
875882
// The test runner's argv doesn't contain claude flags, so the cli
876883
// layer will be Ok with an empty `raw` — but the slot must be Ok,
877884
// not Missing, and the rail row must un-grey.
@@ -887,11 +894,15 @@ mod tests {
887894

888895
#[test]
889896
fn attached_pid_for_live_process_resolves_project_root() {
890-
// The runtime layer's cwd_for_pid filter is "same UID + cwd
891-
// readable" — it doesn't require the target to be named claude
892-
// (that filter runs at discovery time in read_runtime_layer).
893-
// Using our own pid is the cheapest way to exercise the live
894-
// resolution path end-to-end.
897+
// Same Windows caveat as above — `process_for_pid` is Unix-only
898+
// in v1, so this end-to-end attach test only runs on macOS / Linux.
899+
if cfg!(target_os = "windows") {
900+
return;
901+
}
902+
// process_for_pid is gated on same-UID + a readable cwd; it does
903+
// not require the target to be named claude (that filter runs at
904+
// discovery time in read_runtime_layer). Using our own pid is the
905+
// cheapest way to exercise the live resolution path end-to-end.
895906
let our_pid = std::process::id();
896907
let snap = read_snapshot(ProjectSource::Attached(our_pid));
897908
// The test runner's cwd is the project_root we should have read.

0 commit comments

Comments
 (0)