diff --git a/scsh/process.scm b/scsh/process.scm index 9aa5f71..1526d95 100644 --- a/scsh/process.scm +++ b/scsh/process.scm @@ -230,12 +230,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-and-exit maybe-thunk)))) + (move->fdes w 1) + (if maybe-thunk + (with-current-output-port + w + (call-and-exit maybe-thunk)) + (set-current-output-port! w)))) proc))))