chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-janitors] #766: posix: can't collect exit status and close


From: Chicken Trac
Subject: Re: [Chicken-janitors] #766: posix: can't collect exit status and close all process ports at the same time
Date: Tue, 27 Dec 2011 18:54:53 -0000

#766: posix: can't collect exit status and close all process ports at the same
time
----------------------+-----------------------------------------------------
  Reporter:  syn      |       Owner:       
      Type:  defect   |      Status:  new  
  Priority:  major    |   Milestone:  4.8.0
 Component:  unknown  |     Version:  4.7.x
Resolution:           |    Keywords:       
----------------------+-----------------------------------------------------
Description changed by syn:

Old description:

> 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.
> For the time being this can be worked around by calling {{{file-close}}}
> on the ports' file descriptors.
>
> A possible solution might be to
> [http://www.scsh.net/docu/html/man-Z-H-4.html#node_sec_3.4.1 encapsulate
> processes in process objects similar to Scsh] (or [http://docs.racket-
> lang.org/reference/subprocess.html 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: [https://github.com/sellout
> /external-program/wiki/API Common Lisp external-program library].
> Comments welcome.

New description:

 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
 [http://www.scsh.net/docu/html/man-Z-H-4.html#node_sec_3.4.1 encapsulate
 processes in process objects similar to Scsh] (or [http://docs.racket-
 lang.org/reference/subprocess.html 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: [https://github.com/sellout
 /external-program/wiki/API Common Lisp external-program library]. Comments
 welcome.

--

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/766#comment:1>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]