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 19:56:44 -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:       
----------------------+-----------------------------------------------------

Comment(by syn):

 Here's a naive drop-in replacement of {{{process*}}} which works around
 the issue:

 {{{
 (define (process* #!optional cmd args env)
   (let*-values
       (((in-in   in-out) (create-pipe))
        ((out-in out-out) (create-pipe))
        ((err-in err-out) (create-pipe))
        ((pid) (process-fork
                (lambda ()
                  (duplicate-fileno in-in fileno/stdin)
                  (duplicate-fileno out-out fileno/stdout)
                  (duplicate-fileno err-out fileno/stderr)
                  (file-close in-out)
                  (file-close in-in)
                  (file-close out-in)
                  (file-close out-out)
                  (file-close err-in)
                  (file-close err-out)
                  (process-execute cmd args env)))))
     (file-close in-in)
     (file-close out-out)
     (file-close err-out)
     (values (open-input-file*  out-in)
             (open-output-file* in-out)
             pid
             (open-input-file*  err-in))))
 }}}

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/766#comment:2>
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]