1 ;;;; various RUN-PROGRAM tests with side effects
3 ;;;; This software is part of the SBCL system. See the README file for
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
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.
14 (cl:in-package :cl-user)
16 ;; Actually there's no real side-effect here. The impurity we're
17 ;; avoiding is the sigchld handler that RUN-PROGRAM sets up, which
18 ;; interfers with the manual unix process control done by the test
19 ;; framework (sometimes the handler will manage to WAIT3 a process
20 ;; before run-tests WAITPIDs it).
22 (let* ((process (sb-ext:run-program "/bin/cat" '() :wait nil
23 :output :stream :input :stream))
24 (out (process-input process))
25 (in (process-output process)))
27 (loop for i from 0 to 255 do
30 (assert (= (read-byte in) i)))
31 (process-close process)))