--- a/PipeStream.st Tue Apr 27 09:42:52 1999 +0200
+++ b/PipeStream.st Tue Apr 27 19:52:10 1999 +0200
@@ -529,52 +529,52 @@
shellPath shellArgs closeFdArray mbx mbxName|
filePointer notNil ifTrue:[
- "the pipe was already open ...
- this should (can) not happen."
- ^ self errorOpen
+ "the pipe was already open ...
+ this should (can) not happen."
+ ^ self errorOpen
].
lastErrorNumber := nil.
exitStatus := nil.
exitSema := Semaphore new name:'pipe exitSema'.
OperatingSystem isVMSlike ifTrue:[
- mbx := OperatingSystem createMailBox.
- mbx isNil ifTrue:[
- lastErrorNumber := OperatingSystem currentErrorNumber.
- ^ self openError
- ].
- mbxName := OperatingSystem mailBoxNameOf:mbx.
- "/ 'mailBox is ' print. mbx print. ' name is ' print. mbxName printCR.
- shellPath := ''.
- shellArgs := aCommandString.
+ mbx := OperatingSystem createMailBox.
+ mbx isNil ifTrue:[
+ lastErrorNumber := OperatingSystem currentErrorNumber.
+ ^ self openError
+ ].
+ mbxName := OperatingSystem mailBoxNameOf:mbx.
+ "/ 'mailBox is ' print. mbx print. ' name is ' print. mbxName printCR.
+ shellPath := ''.
+ shellArgs := aCommandString.
- mode = 'r' ifTrue:[
- execFdArray := Array with:0 with:mbx with:2.
- ] ifFalse:[
- execFdArray := Array with:mbx with:1 with:2.
- ].
- closeFdArray := nil.
+ mode = 'r' ifTrue:[
+ execFdArray := Array with:0 with:mbx with:2.
+ ] ifFalse:[
+ execFdArray := Array with:mbx with:1 with:2.
+ ].
+ closeFdArray := nil.
] ifFalse:[
- pipeFdArray := OperatingSystem makePipe.
- pipeFdArray isNil ifTrue:[
- lastErrorNumber := OperatingSystem currentErrorNumber.
- ^ self openError
- ].
+ pipeFdArray := OperatingSystem makePipe.
+ pipeFdArray isNil ifTrue:[
+ lastErrorNumber := OperatingSystem currentErrorNumber.
+ ^ self openError
+ ].
- shellAndArgs := OperatingSystem commandAndArgsForOSCommand:aCommandString.
- shellPath := shellAndArgs at:1.
- shellArgs := shellAndArgs at:2.
+ shellAndArgs := OperatingSystem commandAndArgsForOSCommand:aCommandString.
+ shellPath := shellAndArgs at:1.
+ shellArgs := shellAndArgs at:2.
- mode = 'r' ifTrue:[
- execFd := pipeFdArray at:2.
- execFdArray := Array with:0 with:execFd with:2.
- myFd := pipeFdArray at:1.
- ] ifFalse:[
- execFd := pipeFdArray at:1.
- execFdArray := Array with:execFd with:1 with:2.
- myFd := pipeFdArray at:2.
- ].
- closeFdArray := Array with:myFd.
+ mode = 'r' ifTrue:[
+ execFd := pipeFdArray at:2.
+ execFdArray := Array with:0 with:execFd with:2.
+ myFd := pipeFdArray at:1.
+ ] ifFalse:[
+ execFd := pipeFdArray at:1.
+ execFdArray := Array with:execFd with:1 with:2.
+ myFd := pipeFdArray at:2.
+ ].
+ closeFdArray := Array with:myFd.
].
@@ -584,67 +584,67 @@
blocked := OperatingSystem blockInterrupts.
pid := Processor
- monitor:[
- OperatingSystem
- exec:shellPath
- withArguments:shellArgs
- fileDescriptors:execFdArray
- closeDescriptors:closeFdArray
- fork:true
- newPgrp:true
- inDirectory:aDirectrory.
- ]
- action:[:status |
- status stillAlive ifFalse:[
- exitStatus := status.
- OperatingSystem closePid:pid.
- pid := nil.
- exitSema signal.
- ].
- ].
+ monitor:[
+ OperatingSystem
+ exec:shellPath
+ withArguments:shellArgs
+ fileDescriptors:execFdArray
+ closeDescriptors:closeFdArray
+ fork:true
+ newPgrp:true
+ inDirectory:aDirectrory.
+ ]
+ action:[:status |
+ status stillAlive ifFalse:[
+ exitStatus := status.
+ OperatingSystem closePid:pid.
+ pid := nil.
+ exitSema signal.
+ ].
+ ].
OperatingSystem isVMSlike ifFalse:[
- OperatingSystem closeFd:execFd.
+ OperatingSystem closeFd:execFd.
].
pid notNil ifTrue:[
- OperatingSystem isMSDOSlike ifTrue:[
- self setFileDescriptor:myFd mode:mode.
- "/ self setFileHandle:myFd mode:mode
- ] ifFalse:[
- OperatingSystem isVMSlike ifTrue:[
- "/
- "/ reopen the mailbox as a file ...
- "/
- mbxName := OperatingSystem mailBoxNameOf:mbx.
- mbxName notNil ifTrue:[
- super open:mbxName withMode:mode
- ].
- ] ifFalse:[
- self setFileDescriptor:myFd mode:mode.
- ]
- ]
+ OperatingSystem isVMSlike ifTrue:[
+ "/
+ "/ reopen the mailbox as a file ...
+ "/
+ mbxName := OperatingSystem mailBoxNameOf:mbx.
+ mbxName notNil ifTrue:[
+ super open:mbxName withMode:mode
+ ].
+ ] ifFalse:[
+"/ OperatingSystem isMSDOSlike ifTrue:[
+"/ self setFileDescriptor:myFd mode:mode.
+"/ "/ self setFileHandle:myFd mode:mode
+"/ ] ifFalse:[
+ self setFileDescriptor:myFd mode:mode.
+"/ ]
+ ]
] ifFalse:[
- lastErrorNumber := OperatingSystem currentErrorNumber.
- OperatingSystem isVMSlike ifTrue:[
- OperatingSystem destroyMailBox:mbx
- ] ifFalse:[
- OperatingSystem closeFd:myFd.
- ].
+ lastErrorNumber := OperatingSystem currentErrorNumber.
+ OperatingSystem isVMSlike ifTrue:[
+ OperatingSystem destroyMailBox:mbx
+ ] ifFalse:[
+ OperatingSystem closeFd:myFd.
+ ].
].
blocked ifFalse:[
- OperatingSystem unblockInterrupts
+ OperatingSystem unblockInterrupts
].
lastErrorNumber notNil ifTrue:[
- "
- the pipe open failed for some reason ...
- ... this may be either due to an invalid command string,
- or due to the system running out of memory (when forking
- the unix process)
- "
- ^ self openError
+ "
+ the pipe open failed for some reason ...
+ ... this may be either due to an invalid command string,
+ or due to the system running out of memory (when forking
+ the unix process)
+ "
+ ^ self openError
].
commandString := aCommandString.
@@ -689,6 +689,6 @@
!PipeStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.76 1999-02-12 14:54:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.77 1999-04-27 17:52:10 cg Exp $'
! !
PipeStream initialize!