+ ;; make sure that a stream input argument is basically reasonable.
+ (let ((string (let ((i (make-string-input-stream "abcdef")))
+ (with-output-to-string (stream)
+ (sb-ext:run-program "/bin/cat" ()
+ :input i :output stream)))))
+ (assert (= (length string) 6))
+ (assert (string= string "abcdef")))
+
+ ;;; Test the bookkeeping involved in decoding the child's output:
+
+ ;; repeated short, properly-encoded reads exposed one bug. (But
+ ;; note: this test will be inconclusive if the child's stderr is
+ ;; fully buffered.)
+ (let ((str (with-output-to-string (s)
+ (run-program "/bin/sh"
+ '("-c" "(echo Foo; sleep 2; echo Bar)>&2")
+ :output s :search t :error :output :wait t))))
+ (assert (string= str (format nil "Foo~%Bar~%"))))
+
+ ;; end of file in the middle of a UTF-8 character
+ (typep (nth-value 1 (ignore-errors
+ (let ((sb-impl::*default-external-format* :utf-8))
+ (with-output-to-string (s)
+ (run-program "printf" '("\\316")
+ :output s :search t :wait t)))))
+ 'error)
+