#BUGFIX by stefan
class: PipeStream
added: #finishedWithSuccess
changed:
#close
#shutDownOutput
Send EOF to bidirectional pipe (or writing pipe) on close
to terminate command.
--- a/PipeStream.st Tue May 22 17:06:27 2018 +0200
+++ b/PipeStream.st Tue May 22 18:38:10 2018 +0200
@@ -873,13 +873,20 @@
Use abortAndClose for a fast (nonBlocking) close."
self isOpen ifTrue:[
+ self shutDownOutput.
super close.
"/ wait for the pipe-command to terminate.
self waitForPipeCommandWithTimeout:nil.
+"/ Maybe later, currently senders have to retrieve exitstatus manually:
+"/ osProcess finishedWithSuccess ifFalse:[
+"/ exitStatus := osProcess exitStatus.
+"/ StreamError raiseRequestWith:exitStatus errorString:'pipe command failed with exit code: ', exitStatus code printString.
+"/ ].
].
"Modified: / 12-09-1998 / 16:51:04 / cg"
"Modified: / 23-04-2018 / 18:25:04 / stefan"
+ "Modified (comment): / 22-05-2018 / 17:48:15 / Stefan Vogel"
!
shutDown
@@ -896,12 +903,15 @@
|fd|
- self isOpen ifTrue:[
- fd := self fileDescriptor.
- fd notNil ifTrue:[
- OperatingSystem shutdownBidirectionalPipeOutput:fd.
- ].
+ (self isOpen and:[mode ~~ #readonly]) ifTrue:[
+ self flush.
+ fd := self fileDescriptor.
+ fd notNil ifTrue:[
+ OperatingSystem shutdownBidirectionalPipeOutput:fd.
+ ].
].
+
+ "Modified: / 22-05-2018 / 18:34:28 / Stefan Vogel"
! !
!PipeStream methodsFor:'finalization'!
@@ -1080,6 +1090,12 @@
!PipeStream methodsFor:'testing'!
+finishedWithSuccess
+ ^ osProcess notNil and:[osProcess finishedWithSuccess].
+
+ "Created: / 22-05-2018 / 18:17:11 / Stefan Vogel"
+!
+
isPipeStream
^ true
! !