e67a1cf90181b2e13aa41cf0f1a3be27be21f94f
[sbcl.git] / tests / run-program.pure.lisp
1 ;;;; various run-program tests without side effects
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
8 ;;;; from CMU CL.
9 ;;;;
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
13
14 (cl:in-package :cl-user)
15
16 (let* ((process (sb-ext:run-program "/bin/cat" '() :wait nil
17                                     :output :stream :input :stream))
18        (out (process-input process))
19        (in (process-output process)))
20   (unwind-protect
21        (loop for i from 0 to 255 do
22              (write-byte i out)
23              (force-output out)
24              (assert (= (read-byte in) i)))
25     (process-close process)))