From 01b8820c28320434d3ef69bde1cf646d9592f590 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 31 May 2022 01:58:40 -0700 Subject: cygwin: bug: sh always uses cmd.exe. * stream.c (sh): Use a single definition for this function, which uses the shell and shell_arg variables to use either /bin/sh -c or cmd.exe /c. We only want to use cmd.exe when running as a Windows native program on Cygnal. * tests/018/process.tl: Remove workaround from test case. This is what was causing the weirdness. --- stream.c | 13 ++++--------- tests/018/process.tl | 12 +++--------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/stream.c b/stream.c index 0740dda1..be6262b1 100644 --- a/stream.c +++ b/stream.c @@ -4871,11 +4871,6 @@ static val run(val command, val args) return (status < 0) ? nil : num(status); } -static val sh(val command) -{ - return run(lit("cmd.exe"), list(lit("/C"), command, nao)); -} - #elif HAVE_FORK_STUFF static val run(val name, val args) @@ -4948,15 +4943,15 @@ out: return ret; } +#else +#error port me! +#endif + static val sh(val command) { return run(shell, list(shell_arg, command, nao)); } -#else -#error port me! -#endif - val remove_path(val path, val throw_on_error) { val self = lit("remove-path"); diff --git a/tests/018/process.tl b/tests/018/process.tl index ce545dc3..58a12fa2 100644 --- a/tests/018/process.tl +++ b/tests/018/process.tl @@ -16,15 +16,9 @@ ^(with-stream (s (open-subprocess nil "r" nil (lambda () ,*forms))) (get-string s))) -(caseq (os-symbol) - ((:cygwin :cygnal) - (mtest - (fcmd (let ((*stdout* *stdnull*)) (sh "echo foo"))) "" - (fcmd (let ((*stderr* *stdout*)) (sh "echo foo 1>&2"))) "foo \r\n")) - (t - (mtest - (fcmd (let ((*stdout* *stdnull*)) (sh "echo foo"))) "" - (fcmd (let ((*stderr* *stdout*)) (sh "echo foo 1>&2"))) "foo\n"))) +(mtest + (fcmd (let ((*stdout* *stdnull*)) (sh "echo foo"))) "" + (fcmd (let ((*stderr* *stdout*)) (sh "echo foo 1>&2"))) "foo\n") (caseq (os-symbol) ((:cygwin :cygnal)) -- cgit v1.2.3