#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Mon, 29 Oct 2018 16:55:52 +0100
changeset 23486 239a7ae42ee9
parent 23485 aecf0f68402c
child 23487 e9e4dd2d6325
#FEATURE by cg class: OSProcess changed: #execute (send #ensure: instead of #ifCurtailed:) #setupShufflerForInput: #setupShufflerForOutput:
OSProcess.st
--- a/OSProcess.st	Mon Oct 29 16:55:28 2018 +0100
+++ b/OSProcess.st	Mon Oct 29 16:55:52 2018 +0100
@@ -623,9 +623,10 @@
         ^ aStream.
     ].
 
-    pipe := NonPositionableExternalStream makePipe.
+    pipe := PipeStream makePipe.
     externalStream := pipe at:1.
     shuffledStream := pipe at:2.
+    shuffledStream setCommandString:('Stdin of: ',command).
     lineWise ifFalse:[
         shuffledStream blocking:false.
     ].
@@ -669,12 +670,13 @@
 
     "Modified: / 31-01-2017 / 16:50:39 / stefan"
     "Modified (comment): / 23-02-2017 / 10:51:34 / Maren"
-    "Modified: / 15-08-2018 / 14:47:13 / Claus Gittinger"
+    "Modified: / 29-10-2018 / 15:35:01 / Claus Gittinger"
 !
 
 setupShufflerForOutput:aStream
     "if aStream is an internal Stream, set up a pipe for the command output.
-     Start a process that shuffles the data fron the pipe into the internal stream."
+     Start a process that shuffles the data from the pipe's output
+     into the internal stream."
 
     |pipe externalStream shuffledStream shufflerProcess|
 
@@ -682,9 +684,10 @@
         ^ aStream.
     ].
 
-    pipe := NonPositionableExternalStream makePipe.
+    pipe := PipeStream makePipe.
     externalStream := pipe at:2.
     shuffledStream := pipe at:1.
+    shuffledStream setCommandString:('Stdout of: ',command).
     aStream isBinary ifTrue:[
         shuffledStream binary.
     ].
@@ -722,7 +725,7 @@
     ^ externalStream
 
     "Modified: / 31-01-2017 / 16:57:25 / stefan"
-    "Modified: / 15-08-2018 / 14:47:05 / Claus Gittinger"
+    "Modified (comment): / 29-10-2018 / 16:00:55 / Claus Gittinger"
 !
 
 startCommand
@@ -774,7 +777,7 @@
             self waitUntilFinished.
             ok := self finishedWithSuccess.
         ].
-    ] ifCurtailed:[
+    ] ensure:[
         "/ we were interrupted -
         "/ terminate the os-command (and all of its forked commands)
         (streams := streamsToClose) notNil ifTrue:[
@@ -794,7 +797,7 @@
     ^ ok.
 
     "Modified (comment): / 23-02-2017 / 10:54:34 / Maren"
-    "Modified: / 28-10-2018 / 11:36:01 / Claus Gittinger"
+    "Modified: / 29-10-2018 / 15:59:33 / Claus Gittinger"
 !
 
 startProcess