Minimal reproduction of eof on read from child process pasted by sjamaan on Thu Feb 6 15:28:14 2025
(import (chicken process) (chicken io) (chicken file posix) (chicken port)) (receive (in out) (create-pipe) ;; Change the #t to #f and watch it work properly (let ((res (process-fork #f #t))) (cond (res => process-wait) (else (##sys#kill-other-threads (lambda () (file-close in) (duplicate-fileno out 1) (file-close out) (with-output-to-port (open-output-file* 1) (lambda () (display "Hello, world.\n") (exit 1)))))))) (file-close out) (duplicate-fileno in 2) (file-close in) (with-input-from-port (open-input-file* 2) (lambda () (print "GOT FROM CHILD PROCESS: " (read-line)))))
Passing a thunk works, always added by sjamaan on Thu Feb 6 15:30:18 2025
(import (chicken process) (chicken io) (chicken file posix) (chicken port)) (receive (in out) (create-pipe) (process-wait (process-fork ;; NOTE: Wrapping this in ##sys#kill-other-threads makes no difference (lambda () (file-close in) (duplicate-fileno out 1) (file-close out) (with-output-to-port (open-output-file* 1) (lambda () (display "Hello, world.\n") (exit 1)))) #t)) (file-close out) (duplicate-fileno in 2) (file-close in) (with-input-from-port (open-input-file* 2) (lambda () (print "GOT FROM CHILD PROCESS: " (read-line)))))