0.9.10.32:
authorJuho Snellman <jsnell@iki.fi>
Wed, 15 Mar 2006 04:03:26 +0000 (04:03 +0000)
committerJuho Snellman <jsnell@iki.fi>
Wed, 15 Mar 2006 04:03:26 +0000 (04:03 +0000)
Make the streams created by RUN-PROGRAM bivalent. Patch by
        James Bielman on sbcl-devel, except:

        * Also bivalentify (bivalenticate? bivalentize?) the PTY stream
        * Add a test

NEWS
src/code/run-program.lisp
tests/run-program.pure.lisp [new file with mode: 0644]
version.lisp-expr

diff --git a/NEWS b/NEWS
index 37c364f..0401dcc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,9 @@ changes in sbcl-0.9.11 relative to sbcl-0.9.10:
   * fixed bug: occasional GC crashes on Solaris/x86
   * optimization: x86-64 supports stack allocation of results of simple
     calls of MAKE-ARRAY, bound to variables, declared DYNAMIC-EXTENT
+  * enchancement: the PROCESS-INPUT and -OUTPUT streams created by 
+    SB-EXT:RUN-PROGRAM can be used for both character and byte IO
+    (thanks to James Bielman)
 
 changes in sbcl-0.9.10 relative to sbcl-0.9.9:
   * new feature: new SAVE-LISP-AND-DIE keyword argument :EXECUTABLE can
index 18ad9f1..5088023 100644 (file)
@@ -384,6 +384,7 @@ The function is called with PROCESS as its only argument.")
           (copy-descriptor-to-stream new-fd pty cookie)))
       (values name
               (sb-sys:make-fd-stream master :input t :output t
+                                     :element-type :default
                                      :dual-channel-p t)))))
 
 (defmacro round-bytes-to-words (n)
@@ -777,12 +778,14 @@ colon-separated list of pathnames SEARCH-PATH"
              (:input
               (push read-fd *close-in-parent*)
               (push write-fd *close-on-error*)
-              (let ((stream (sb-sys:make-fd-stream write-fd :output t)))
+              (let ((stream (sb-sys:make-fd-stream write-fd :output t
+                                                   :element-type :default)))
                 (values read-fd stream)))
              (:output
               (push read-fd *close-on-error*)
               (push write-fd *close-in-parent*)
-              (let ((stream (sb-sys:make-fd-stream read-fd :input t)))
+              (let ((stream (sb-sys:make-fd-stream read-fd :input t
+                                                   :element-type :default)))
                 (values write-fd stream)))
              (t
               (sb-unix:unix-close read-fd)
diff --git a/tests/run-program.pure.lisp b/tests/run-program.pure.lisp
new file mode 100644 (file)
index 0000000..e67a1cf
--- /dev/null
@@ -0,0 +1,25 @@
+;;;; various run-program tests without side effects
+
+;;;; This software is part of the SBCL system. See the README file for
+;;;; more information.
+;;;;
+;;;; While most of SBCL is derived from the CMU CL system, the test
+;;;; files (like this one) were written from scratch after the fork
+;;;; from CMU CL.
+;;;;
+;;;; This software is in the public domain and is provided with
+;;;; absolutely no warranty. See the COPYING and CREDITS files for
+;;;; more information.
+
+(cl:in-package :cl-user)
+
+(let* ((process (sb-ext:run-program "/bin/cat" '() :wait nil
+                                    :output :stream :input :stream))
+       (out (process-input process))
+       (in (process-output process)))
+  (unwind-protect
+       (loop for i from 0 to 255 do
+             (write-byte i out)
+             (force-output out)
+             (assert (= (read-byte in) i)))
+    (process-close process)))
index 0ccb57c..5e800f1 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.10.31"
+"0.9.10.32"