Commit 12acba0e authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Fix run-program on ccl/windows. More tweaks for allegro/windows.

parent 2f7e8f38
...@@ -141,6 +141,11 @@ do_tests () { ...@@ -141,6 +141,11 @@ do_tests () {
fi fi
} }
case $(uname) in
CYGWIN*) os=windows ;;
*) os=unix ;;
esac
# terminate on error # terminate on error
set -e set -e
...@@ -152,13 +157,15 @@ case "$lisp" in ...@@ -152,13 +157,15 @@ case "$lisp" in
eval="--eval" ;; eval="--eval" ;;
allegro) allegro)
command="${ALLEGRO:-alisp}" command="${ALLEGRO:-alisp}"
#flags="-q" flags="-q"
nodebug="-batch" nodebug="-batch"
if [ "$os" = windows ] ; then nodebug="$nodebug +c" ; fi
eval="-e" ;; eval="-e" ;;
allegromodern) allegromodern)
command="${ALLEGROMODERN:-mlisp}" command="${ALLEGROMODERN:-mlisp}"
flags="-q" flags="-q"
nodebug="-batch" nodebug="-batch"
if [ "$os" = windows ] ; then nodebug="$nodebug +c" ; fi
eval="-e" ;; eval="-e" ;;
ccl) ccl)
command="${CCL:-ccl}" command="${CCL:-ccl}"
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
(declaim (optimize (debug 3) (safety 3))) (declaim (optimize (debug 3) (safety 3)))
(DBG "Testing echo ok 1 via run-program as a list") (DBG "Testing echo ok 1 via run-program as a list")
(assert-equal '("ok 1") (run-program '("echo" "ok" "1") :output :lines)) (assert-equal "ok 1" (run-program '("echo" "ok" "1") :output '(:string :stripped t)))
(DBG "Testing echo ok 1 via run-program as a string") (DBG "Testing echo ok 1 via run-program as a string")
(assert-equal '("ok 1") (run-program "echo ok 1" :output :lines)) (assert-equal "ok 1" (run-program "echo ok 1" :output '(:string :stripped t)))
;; (unless (os-unix-p) (leave-test "The rest of this test is only supposed to work on Unix")) ;; (unless (os-unix-p) (leave-test "The rest of this test is only supposed to work on Unix"))
......
...@@ -46,6 +46,20 @@ ...@@ -46,6 +46,20 @@
(setf excl:*warn-on-nested-reader-conditionals* nil)) (setf excl:*warn-on-nested-reader-conditionals* nil))
(setf *print-readably* nil)) (setf *print-readably* nil))
#+clozure
(in-package :ccl)
#+(and clozure windows-target)
(eval-when (:load-toplevel :compile-toplevel :execute)
(unless (fboundp 'external-process-wait)
(in-development-mode
(defun external-process-wait (proc)
(when (external-process-pid proc))
(with-interrupts-enabled
(wait-on-semaphore (external-process-completed proc)))))))
#+clozure
(in-package :uiop/common-lisp)
#+cormanlisp #+cormanlisp
(eval-when (:load-toplevel :compile-toplevel :execute) (eval-when (:load-toplevel :compile-toplevel :execute)
(deftype logical-pathname () nil) (deftype logical-pathname () nil)
......
...@@ -560,7 +560,7 @@ It returns a process-info plist with possible keys: ...@@ -560,7 +560,7 @@ It returns a process-info plist with possible keys:
(let ((process (getf process-info :process))) (let ((process (getf process-info :process)))
(when process (when process
;; 1- wait ;; 1- wait
#+(and clozure os-unix) (ccl::external-process-wait process) #+clozure (ccl::external-process-wait process)
#+(or cmu scl) (ext:process-wait process) #+(or cmu scl) (ext:process-wait process)
#+(and ecl os-unix) (ext:external-process-wait process) #+(and ecl os-unix) (ext:external-process-wait process)
#+sbcl (sb-ext:process-wait process) #+sbcl (sb-ext:process-wait process)
......
...@@ -364,13 +364,17 @@ Otherwise, using WRITE-SEQUENCE using a buffer of size BUFFER-SIZE." ...@@ -364,13 +364,17 @@ Otherwise, using WRITE-SEQUENCE using a buffer of size BUFFER-SIZE."
(defun slurp-stream-lines (input &key count) (defun slurp-stream-lines (input &key count)
"Read the contents of the INPUT stream as a list of lines, return those lines. "Read the contents of the INPUT stream as a list of lines, return those lines.
Note: relies on the Lisp's READ-LINE, but additionally removes any remaining CR
from the line-ending if the file or stream had CR+LF but Lisp only removed LF.
Read no more than COUNT lines." Read no more than COUNT lines."
(check-type count (or null integer)) (check-type count (or null integer))
(with-open-stream (input input) (with-open-stream (input input)
(loop :for n :from 0 (loop :for n :from 0
:for l = (and (or (not count) (< n count)) :for l = (and (or (not count) (< n count))
(read-line input nil nil)) (read-line input nil nil))
:while l :collect l))) ;; stripln: to remove CR when the OS sends CRLF and Lisp only remove LF
:while l :collect (stripln l))))
(defun slurp-stream-line (input &key (at 0)) (defun slurp-stream-line (input &key (at 0))
"Read the contents of the INPUT stream as a list of lines, "Read the contents of the INPUT stream as a list of lines,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment