Exit status for a process run with open "| ..." 
Author Message
 Exit status for a process run with open "| ..."

Is there a way to retrieve the exit status of a process that is run by
opening a pipe?  I've got something like:

      set fid [open $cmdLine "r"]
      fconfigure $fid -buffering none -blocking 0 -translation binary
      fileevent $fid readable "myReadResults $fid"

      set exitstatus [catch {vwait fio_done} out]

but exitstatus seems to be the status of the vwait, not the command.

                                 Chris
--
Chris Nelson                               As MIT is not "Massachusetts"




Mon, 20 Mar 2000 03:00:00 GMT  
 Exit status for a process run with open "| ..."

Quote:

> Is there a way to retrieve the exit status of a process that is run by
> opening a pipe?

Don't you get it when you close the pipe?  Behold:

% set fid [open |[list [info nameofexecutable] no-file.tcl] r]
file72
% set text [read $fid]
% catch {close $fid} status
1
% set status
couldn't read file "no-file.tcl": no such file or directory
% set errorCode
CHILDSTATUS -1 1
% set errorInfo
couldn't read file "no-file.tcl": no such file or directory
    while executing
"close $fid"

--
73 de ke9tv/2, Kevin KENNY      GE Corporate R&D, Niskayuna, New York, USA



Mon, 20 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. cgi-bin "exec": error waiting for process to exit: No child processes

2. Q: "on exit" processing

3. catch: removing "child process exited abnormally"

4. When to run "exit" code

5. system, open("|..") and process ids

6. Process and "open"

7. Background processes using "open" command

8. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

9. Q: How to kill process started by "exec" or "open".

10. What replaces "EXIT"?

11. problem with "exiting".........

12. Py_Exit if "exit" not required

 

 
Powered by phpBB® Forum Software