proc: the /bin/sh tests of CombinedOutputOwn skip on Windows

TestCombinedOutputOwnRuns and TestCombinedOutputOwnContext (531b44a9a)
run /bin/sh, which Windows lacks, so internal/proc was red on the
Windows box at origin/main (exec: "/bin/sh": executable file not found
in %PATH%). Windows CI only compiles tests, so nothing showed it. They
skip there now, as TestCombinedOutputOwnAnswersForItself already does
off macOS.

What was run (this tree):
- win-run go test -count=1 ./internal/proc/: ok 8.6s (red at
  origin/main with the two tests above).
- mote: go test -run 'TestCombinedOutputOwn|TestTreeRSS' -v
  ./internal/proc/: all four pass, none skipped.
This commit is contained in:
yetone
2026-10-28 18:26:59 +08:00
parent b569d1ab77
commit 7fe98c2afd
+10
View File
@@ -56,7 +56,16 @@ func TestCombinedOutputOwnAnswersForItself(t *testing.T) {
}
}
// noShell skips a test that drives /bin/sh where there is none (Windows).
func noShell(t *testing.T) {
t.Helper()
if runtime.GOOS == "windows" {
t.Skip("no /bin/sh on Windows")
}
}
func TestCombinedOutputOwnRuns(t *testing.T) {
noShell(t)
dir := t.TempDir()
cmd := Command("/bin/sh", "-c", "pwd; echo \"$MAGPIE_T\"; echo err >&2; if [ -p /dev/stdin ]; then echo pipe; else echo other; fi; exit 3")
cmd.Env = append(os.Environ(), "MAGPIE_T=v")
@@ -80,6 +89,7 @@ func TestCombinedOutputOwnRuns(t *testing.T) {
// The context ending ends the command, and the run with it.
func TestCombinedOutputOwnContext(t *testing.T) {
noShell(t)
ctx, cancel := context.WithCancel(context.Background())
done := make(chan error, 1)
go func() {