diff --git a/ice-9/popen.scm b/ice-9/popen.scm index 35feb7447..5689e5ffc 100644 --- a/ice-9/popen.scm +++ b/ice-9/popen.scm @@ -23,9 +23,7 @@ (cond ((= pid 0) ;; child (set-batch-mode?! #t) - (if reading - (close-port (car p)) - (close-port (cdr p))) + (close-all-ports-except (if reading (cdr p) (car p))) (move->fdes (if reading (cdr p) (car p)) (if reading 1 0)) (apply execlp prog prog args))