#BUGFIX by stefan
authorStefan Vogel <sv@exept.de>
Thu, 24 May 2018 18:07:14 +0200
changeset 23006 0427d51adb60
parent 23005 66ed1ac009dd
child 23007 cae37a19473b
#BUGFIX by stefan class: OSProcess changed: #startProcess evaluate terminateActionBlock also when process couldn't be started
OSProcess.st
--- a/OSProcess.st	Thu May 24 17:49:57 2018 +0200
+++ b/OSProcess.st	Thu May 24 18:07:14 2018 +0200
@@ -5,19 +5,19 @@
 "{ NameSpace: Smalltalk }"
 
 Object subclass:#OSProcess
-	instanceVariableNames:'pid command environment directory inStream outStream errorStream
-		auxStream showWindow lineWise newPgrp exitStatus finishSema
-		shufflerProcesses streamsToClose terminateActionBlock'
-	classVariableNames:''
-	poolDictionaries:''
-	category:'System-Support'
+        instanceVariableNames:'pid command environment directory inStream outStream errorStream
+                auxStream showWindow lineWise newPgrp exitStatus finishSema
+                shufflerProcesses streamsToClose terminateActionBlock'
+        classVariableNames:''
+        poolDictionaries:''
+        category:'System-Support'
 !
 
 OSProcess subclass:#RemoteOSProcess
-	instanceVariableNames:'host'
-	classVariableNames:'MethodPerHost'
-	poolDictionaries:''
-	privateIn:OSProcess
+        instanceVariableNames:'host'
+        classVariableNames:'MethodPerHost'
+        poolDictionaries:''
+        privateIn:OSProcess
 !
 
 !OSProcess class methodsFor:'documentation'!
@@ -740,9 +740,8 @@
         action:[:status |
             status stillAlive ifFalse:[
                 exitStatus := status.
-                pid notNil ifTrue:[
-                    OperatingSystem closePid:pid.
-                ].
+                self terminate.
+
                 "/ shufflerProcesses do:[:eachProcess|
                 "/     "terminate the shuffler processes.
                 "/      They close the local side of the pipe when being terminated"
@@ -775,12 +774,15 @@
         shufflerProcesses := nil.
         exitStatus := OperatingSystem osProcessStatusClass processCreationFailure.
         finishSema signal.
+        terminateActionBlock notNil ifTrue:[
+            terminateActionBlock valueWithOptionalArgument:exitStatus and:self.
+        ].
         ^ false.
     ].
 
     ^ true.
 
-    "Modified: / 22-05-2018 / 22:14:38 / Stefan Vogel"
+    "Modified: / 24-05-2018 / 17:58:40 / Stefan Vogel"
     "Modified: / 24-05-2018 / 17:40:50 / Claus Gittinger"
 ! !