Skip to content

Commit cea6084

Browse files
mikolalysenkoclaude
andcommitted
fix(windows CI): docker_vendor_common_selftest ran against the WSL bash stub
has_bash() only checked that `bash` SPAWNED — on windows-latest, Command::new("bash") resolves to the System32 WSL stub (no distro installed), which spawns fine but cannot run a script: it prints its error as UTF-16 on stdout and exits non-zero, failing all three stage_patch selftests with empty stderr. Probe an actual `bash -c` run and require the sentinel back, so hosts without a functional bash skip (the snippets' real target is the Linux docker images; unix CI hosts keep full coverage). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 5dae1dc commit cea6084

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎crates/socket-patch-cli/tests/docker_vendor_common_selftest.rs‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@ use docker_vendor_common::{bash_prelude, stage_patch_fn};
2525
const SHA256SUM_SHIM: &str =
2626
"command -v sha256sum >/dev/null 2>&1 || sha256sum() { shasum -a 256 \"$@\"; }\n";
2727

28+
/// A *functional* bash, not merely a spawnable one: on windows-latest
29+
/// `Command::new("bash")` resolves to the System32 WSL stub, which spawns
30+
/// fine with no distro installed but cannot run a script (it prints its
31+
/// error as UTF-16 on stdout and exits non-zero) — `.status().is_ok()`
32+
/// passed on it and the suite ran against a bash that executes nothing.
33+
/// Probe an actual `-c` run and require the sentinel to come back.
2834
fn has_bash() -> bool {
2935
Command::new("bash")
30-
.arg("--version")
31-
.stdout(Stdio::null())
36+
.args(["-c", "echo bash-probe-ok"])
3237
.stderr(Stdio::null())
33-
.status()
34-
.is_ok()
38+
.output()
39+
.map(|o| o.status.success() && String::from_utf8_lossy(&o.stdout).contains("bash-probe-ok"))
40+
.unwrap_or(false)
3541
}
3642

3743
/// Run `body` under the same prelude + stage_patch definitions the docker

0 commit comments

Comments
 (0)