Commit 3c514bfe authored by Elias Pipping's avatar Elias Pipping
Browse files

Fix test-run-program on windows

We cannot use `exit` on Windows with :force-shell nil (it's a builtin);
use `cmd /c exit` instead.

Using `exit` on Unix with :force-shell nil may or may not work (it's a
builtin but CL implementations typically invoke a shell anyway).
`true` and `false` are guaranteed to exist by the POSIX standard.
parent 79ec789a
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -42,10 +42,18 @@
(DBG "Testing exit status with :output :interactive")
(DBG "Testing exit status with :output :interactive")
;; This test checks for a problem there was in allegro -- :output :interactive
;; This test checks for a problem there was in allegro -- :output :interactive
;; would try to open T as a stream for INPUT.
;; would try to open T as a stream for INPUT.
(assert-equal '(nil nil 0) (multiple-value-list (run-program "exit 0" :force-shell t :output :interactive)))
(loop
(assert-equal '(nil nil 0) (multiple-value-list (run-program "exit 0" :force-shell nil :output :interactive)))
   :for (program . exit-code) :in
(assert-equal '(nil nil 1) (multiple-value-list (run-program "exit 1" :force-shell t :output :interactive :ignore-error-status t)))
   #+os-unix '(("true" . 0) ("false" . 1))
(assert-equal '(nil nil 1) (multiple-value-list (run-program "exit 1" :force-shell nil :output :interactive :ignore-error-status t)))
   #+os-windows '(("cmd /c exit 0" . 0) ("cmd /c exit 1" . 1))
   :do (loop
          :for force-shell :in '(t nil)
          :do (assert-equal `(nil nil ,exit-code)
                            (multiple-value-list
                             (run-program program
                                          :ignore-error-status t
                                          :force-shell force-shell
                                          :output :interactive)))))
(assert-equal
(assert-equal
 '("foo" "bar baz" 42)
 '("foo" "bar baz" 42)
 (multiple-value-bind (o e c)
 (multiple-value-bind (o e c)