OSProcess.st
changeset 23793 e4692ca78427
parent 23648 1f17471db39f
child 23907 f0b35054f5d0
--- a/OSProcess.st	Sat Mar 02 14:21:28 2019 +0100
+++ b/OSProcess.st	Sat Mar 02 19:20:32 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "{ Package: 'stx:libbasic' }"
 
 "{ NameSpace: Smalltalk }"
@@ -7,7 +9,7 @@
 		auxStream showWindow lineWise newPgrp exitStatus finishSema
 		inputShufflerProcesses outputShufflerProcesses streamsToClose
 		terminateActionBlock'
-	classVariableNames:''
+	classVariableNames:'Instances'
 	poolDictionaries:''
 	category:'System-Support'
 !
@@ -180,6 +182,22 @@
 
 !OSProcess class methodsFor:'instance creation'!
 
+allInstancesDo:aBlock
+    "return an initialized instance for a local process.
+     Keep track of the new instance (so we can quickly enumerate all of them)"
+
+    Instances notNil ifTrue:[ 
+        Instances do:aBlock
+    ].
+    
+    "
+     super allInstances
+     self allInstances
+    "
+
+    "Created: / 02-03-2019 / 19:19:41 / Claus Gittinger"
+!
+
 command:aCommandString
     "return an initialized instance to execute aCommandString
      in the current directory (for a local process)"
@@ -211,9 +229,19 @@
 !
 
 new
-    "return an initialized instance for a local process"
+    "return an initialized instance for a local process.
+     Keep track of the new instance (so we can quickly enumerate all of them)"
 
-    ^ self basicNew initialize.
+    |newInst|
+    
+    Instances isNil ifTrue:[
+        Instances := WeakIdentitySet new
+    ].    
+    newInst := self basicNew initialize.
+    Instances add:newInst.
+    ^ newInst
+
+    "Modified (comment): / 02-03-2019 / 19:15:25 / Claus Gittinger"
 !
 
 onHost:aHost