Opened 13 years ago

Last modified 7 years ago

#766 new defect

posix: can't collect exit status and close all process ports at the same time — at Version 1

Reported by: Moritz Heidkamp Owned by:
Priority: not urgent at all Milestone: someday
Component: core libraries Version: 4.7.x
Keywords: Cc:
Estimated difficulty: hard

Description (last modified by Moritz Heidkamp)

It is currently impossible to call process-wait on a PID to collect the exit status of child process and close all associated input and output ports afterwards. This is due to close-[input|output]-port implicitly calling process-wait on process pipe ports. This leads to errors like

Error: (process-wait) waiting for child process failed - No child processes: 10872

because the process has already been purged by the OS at that point. This could be worked around by calling file-close on the ports' file descriptors. However, port->fileno does not work on process ports.

A possible solution might be to encapsulate processes in process objects similar to Scsh (or subprocess values as Racket calls them) and change process-wait to retain the process' exit status once it has been collected, allowing for it to be called multiple times. This would of course break backwards compatibility and thus should be handled as a Change Request. See also: Common Lisp external-program library. Comments welcome.

Change History (1)

comment:1 Changed 13 years ago by Moritz Heidkamp

Description: modified (diff)
Note: See TracTickets for help on using tickets.