Care about closing copied file-descriptor/ports in parent and child of

RUN/FG*.
This commit is contained in:
eknauel 2005-08-11 15:18:25 +00:00
parent 843ed0493b
commit 8eedb14ef3
1 changed files with 6 additions and 6 deletions

View File

@ -329,24 +329,24 @@
(let ((foreground-pgrp (tty-process-group (current-output-port)))
(proc
(fork
(lambda ()
(lambda ()
;; this a forked child
(close-input-port rport)
(set-process-group (pid) (pid))
(set-tty-process-group (current-output-port) (pid))
(let ((status (eval-s-expr s-expr)))
;; I don't understand it. Send list, will work.
;; Send integer, READ will sit there and wait for ever.
;; Sigh.
(write (list status) wport)
(write status wport)
(close-output-port wport)
;; We can't call EXIT with a scsh encoded status code,
;; because the value does not fit into a byte. Sigh.
;; Send value over pipe instead.
(exit 0))))))
(close-output-port wport)
(let* ((job (make-job-sans-console
s-expr proc
;; truely evil, I think.
(lambda (ignore)
(let ((v (car (read rport)))) ;; see above
(let ((v (read rport)))
(close-input-port rport)
v))))
(status (job-status job)))