Artifacts Associated With Ticket 218484ffffffffff
Ticket change [ee07b8785f] (rid 104011) by nobody on 2000-10-26 01:01:07:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 692 Bug Version: 8.0.3 SubmitDate: '1998-10-02' LastModified: '1999-12-03' Severity: SER Status: Released Submitter: hershey ChangedBy: hobbs OS: All OSVersion: NA Machine: NA FixedDate: '1999-12-03' FixedInVersion: 8.0.5 ClosedDate: '2000-10-25' Following examples discussed in c.l.t, and documented at <URL: ftp://ftp.neosoft.com/pub/tcl/sorted/text/tclarch.txt>, I've been using [open |] + [fileevent] for inter-process communication, and I've used [catch {close $pipe}] to get the exit status of the child process. I'm sad to report that this mechanism is broken in Tcl 8.0.3, as the following short example will demonstrate: visage:tmp: cat child.tcl #!/bin/sh # exec tclsh "$0" ${1+"$@"} puts stderr "Msg to stderr" puts stdout "Msg to stdout" exit 1 visage:tmp: cat parent.tcl #!/bin/sh # exec tclsh "$0" ${1+"$@"} puts "Tcl patch level: [info patchlevel]" proc Handler {f} { if {[gets $f line]<0} { global ExecDone errorCode if {[catch {close $f} res]} { set ExecDone [list 1 $res $errorCode] } else { set ExecDone [list 0] } return } puts $line } set f [open [concat | 2>@ stderr child.tcl] r] fileevent $f readable [list Handler $f] vwait ExecDone if {[lindex $ExecDone 0]} { puts stderr "ERROR: [lindex $ExecDone 1]" puts stderr "CODE: [lindex $ExecDone 2]" } visage:tmp: ./parent.tcl Tcl patch level: 8.0p2 Msg to stderr Msg to stdout ERROR: child process exited abnormally CODE: CHILDSTATUS 3299 1 sycamore:tmp: ./parent.tcl Tcl patch level: 8.0.3 Msg to stderr Msg to stdout This inconsistency breaks existing scripts, and seemingly prevents a parent process from gathering the exit status of its child when they are connected via a pipeline. Don Porter Results from 8.0.5: op [~/tmp/auto] 140 % ./parent.tcl Tcl patch level: 8.0.5 Msg to stderr Msg to stdout ERROR: child process exited abnormally CODE: CHILDSTATUS 16122 1 As desired. -- 12/03/1999 hobbs - foundin initialized to: "obsolete: 8.0.3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "60. NRE and coroutines"
- title initialized to:
can't use [catch {close $pipe}] to get the exit status of t - type initialized to: "Bug"
Ticket change [8ea5da08c8] (rid 120147) by welch on 2000-10-26 08:23:17:
- closedate changed to: "2000-10-26T01:23:17"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [3fa1f1c9c3] (rid 121497) by dgp on 2001-04-05 08:20:13:
- closedate changed to: "2001-04-05T01:20:13"
- closer changed to: "dgp"
- subsystem changed to: "27. Channel Types"