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))))