From 9d93d5a61e600222099884f2f71edace94dbfb60 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Mon, 21 Jul 2003 12:02:55 +0000 Subject: [PATCH] After fork/pipe, make the ports returned by the pipe the current-in/output-ports. This corresponds to the intended semantics of side-effecting the standard ports and tells the GC that the ports are alive. --- scsh/scsh.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scsh/scsh.scm b/scsh/scsh.scm index dc72cd1..cc53d49 100644 --- a/scsh/scsh.scm +++ b/scsh/scsh.scm @@ -36,12 +36,16 @@ (let ((proc (forker #f no-new-command-level?))) (cond (proc ; Parent (close w) - (move->fdes r 0)) + (move->fdes r 0) + (set-current-input-port! r)) (else ; Child (close r) - (move->fdes w 1) - (if maybe-thunk - (call-terminally maybe-thunk)))) + (move->fdes w 1) + (if maybe-thunk + (with-current-output-port + w + (call-terminally maybe-thunk)) + (set-current-output-port! w)))) proc))))