+ (assert (string= string "foo bar
+")))
+ ;; Unix environment strings are ordinarily passed with SBCL convention
+ ;; (instead of CMU CL alist-of-keywords convention).
+ (let ((string (with-output-to-string (stream)
+ (sb-ext:run-program "/usr/bin/env" ()
+ :output stream
+ :environment '("FEEFIE=foefum")))))
+ (assert (string= string "FEEFIE=foefum
+")))
+ ;; The default Unix environment for the subprocess is the same as
+ ;; for the parent process. (I.e., we behave like perl and lots of
+ ;; other programs, but not like CMU CL.)
+ (let ((string (with-output-to-string (stream)
+ (sb-ext:run-program "/usr/bin/env" ()
+ :output stream)))
+ (expected (apply #'concatenate
+ 'string
+ (mapcar (lambda (environ-string)
+ (concatenate 'string
+ environ-string
+ (string #\newline)))
+ (sb-ext:posix-environ)))))
+ (assert (string= string expected)))
+ ;; That's not just because POSIX-ENVIRON is having a bad hair
+ ;; day and returning NIL, is it?
+ (assert (plusp (length (sb-ext:posix-environ))))
+ ;; 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")))
+ ;; success convention for this Lisp program run as part of a larger script
+ (sb-ext:quit :unix-status 52)))