Fix race condition in PipeStream.
This race could falsly report io errors when forking subprocesses.
--- a/PipeStream.st Wed Jan 24 19:55:33 2007 +0100
+++ b/PipeStream.st Fri Jan 26 14:17:00 2007 +0100
@@ -566,7 +566,7 @@
|blocked pipeFdArray execFdArray execFd myFd shellAndArgs
shellPath shellArgs mbx mbxName
- realCmd execDirectory tmpComFile nullOutput|
+ realCmd execDirectory tmpComFile nullOutput resultPid|
filePointer notNil ifTrue:[
"the pipe was already open ...
@@ -665,7 +665,8 @@
blocked := OperatingSystem blockInterrupts.
- pid := Processor
+ "beware: pid may change if subprocess is fast"
+ pid := resultPid := Processor
monitor:[
OperatingSystem
exec:shellPath
@@ -705,7 +706,7 @@
nullOutput close
].
- pid notNil ifTrue:[
+ resultPid notNil ifTrue:[
"successfull creation of subprocesss"
OperatingSystem isVMSlike ifTrue:[
"/
@@ -734,7 +735,7 @@
OperatingSystem unblockInterrupts
].
- (pid isNil or:[lastErrorNumber notNil]) ifTrue:[
+ (resultPid isNil or:[lastErrorNumber notNil]) ifTrue:[
"
the pipe open failed for some reason ...
... this may be either due to an invalid command string,
@@ -788,7 +789,7 @@
!PipeStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.105 2007-01-19 13:50:01 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.106 2007-01-26 13:17:00 stefan Exp $'
! !
PipeStream initialize!