oops - shuffled error onto output;
authorMichael Beyl <mb@exept.de>
Mon, 28 Jan 2002 20:52:23 +0100
changeset 6367 951561304907
parent 6366 cca909489f2f
child 6368 b47f69f626fe
oops - shuffled error onto output; did not terminate shufflers if aborted
AbstractOperatingSystem.st
--- a/AbstractOperatingSystem.st	Fri Jan 25 13:43:49 2002 +0100
+++ b/AbstractOperatingSystem.st	Mon Jan 28 20:52:23 2002 +0100
@@ -1155,7 +1155,7 @@
 
     |pid exitStatus sema pIn pOut pErr externalInStream externalOutStream externalErrStream 
      inputShufflerProcess outputShufflerProcess errorShufflerProcess
-     inStreamToClose outStreamToClose errStreamToClose terminateLock|
+     inStreamToClose outStreamToClose errStreamToClose terminateLock stopShufflers|
 
     terminateLock := Semaphore forMutualExclusion.
 
@@ -1261,10 +1261,10 @@
                             terminateLock critical:[
                                 lineWise ifTrue:[
                                     data := s nextLine.
-                                    data notNil ifTrue:[anOutStream nextPutLine:data.].
+                                    data notNil ifTrue:[anErrStream nextPutLine:data.].
                                 ] ifFalse:[
                                     data := s nextAvailable:1024.
-                                    data size > 0 ifTrue:[anOutStream nextPutAll:data.].
+                                    data size > 0 ifTrue:[anErrStream nextPutAll:data.].
                                 ]
                             ]
                         ]
@@ -1273,10 +1273,10 @@
                         [
                             lineWise ifTrue:[
                                 data := s nextLine.
-                                data notNil ifTrue:[anOutStream nextPutLine:data].
+                                data notNil ifTrue:[anErrStream nextPutLine:data].
                             ] ifFalse:[
                                 data := s nextAvailable:1024.
-                                data size > 0 ifTrue:[anOutStream nextPutAll:data].
+                                data size > 0 ifTrue:[anErrStream nextPutAll:data].
                             ]
                         ] doUntil:[data size == 0].
                         s close.
@@ -1313,6 +1313,37 @@
                     ].
                 ].
 
+    stopShufflers := [
+        inputShufflerProcess notNil ifTrue:[
+            terminateLock critical:[
+                inputShufflerProcess terminate.
+            ].
+            inputShufflerProcess waitUntilTerminated.
+        ].
+        outputShufflerProcess notNil ifTrue:[
+            terminateLock critical:[
+                outputShufflerProcess terminate.
+            ].
+            outputShufflerProcess waitUntilTerminated.
+        ].
+        errorShufflerProcess notNil ifTrue:[
+            terminateLock critical:[
+                errorShufflerProcess terminate.
+            ].
+            errorShufflerProcess waitUntilTerminated.
+        ].
+
+        errStreamToClose notNil ifTrue:[
+            errStreamToClose close
+        ].
+        outStreamToClose notNil ifTrue:[
+            outStreamToClose close
+        ].
+        inStreamToClose notNil ifTrue:[
+            inStreamToClose close
+        ].
+    ].
+
     pid notNil ifTrue:[
         [
             sema wait.
@@ -1321,40 +1352,13 @@
             self terminateProcessGroup:pid.
             self terminateProcess:pid.
             self closePid:pid.
+            stopShufflers value.    
         ]
     ] ifFalse:[
         exitStatus := self osProcessStatusClass processCreationFailure.
     ].
 
-    inputShufflerProcess notNil ifTrue:[
-        terminateLock critical:[
-            inputShufflerProcess terminate.
-        ].
-        inputShufflerProcess waitUntilTerminated.
-    ].
-    outputShufflerProcess notNil ifTrue:[
-        terminateLock critical:[
-            outputShufflerProcess terminate.
-        ].
-        outputShufflerProcess waitUntilTerminated.
-    ].
-    errorShufflerProcess notNil ifTrue:[
-        terminateLock critical:[
-            errorShufflerProcess terminate.
-        ].
-        errorShufflerProcess waitUntilTerminated.
-    ].
-
-    errStreamToClose notNil ifTrue:[
-        errStreamToClose close
-    ].
-    outStreamToClose notNil ifTrue:[
-        outStreamToClose close
-    ].
-    inStreamToClose notNil ifTrue:[
-        inStreamToClose close
-    ].
-
+    stopShufflers value.    
     exitStatus success ifFalse:[
         ^ aBlock value:exitStatus
     ].
@@ -1400,6 +1404,7 @@
     "Modified: / 28.1.1998 / 14:46:36 / md"
     "Modified: / 10.11.1998 / 20:48:08 / cg"
     "Created: / 10.11.1998 / 20:51:11 / cg"
+    "Modified: / 28.1.2002 / 20:51:00 / micha"
 !
 
 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream inDirectory:dirOrNil onError:aBlock
@@ -4456,6 +4461,6 @@
 !AbstractOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.59 2002-01-15 15:20:33 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.60 2002-01-28 19:52:23 mb Exp $'
 ! !
 AbstractOperatingSystem initialize!