--- a/OSProcess.st Tue Sep 03 18:56:50 2019 +0200
+++ b/OSProcess.st Wed Sep 04 08:57:10 2019 +0200
@@ -6,9 +6,9 @@
Object subclass:#OSProcess
instanceVariableNames:'pid command environment directory inStream outStream errorStream
- auxStream showWindow lineWise newPgrp exitStatus finishSema
- inputShufflerProcesses outputShufflerProcesses streamsToClose
- terminateActionBlock'
+ auxInStream auxOutStream showWindow lineWise newPgrp exitStatus
+ finishSema inputShufflerProcesses outputShufflerProcesses
+ streamsToClose terminateActionBlock'
classVariableNames:'Instances'
poolDictionaries:''
category:'System-Support'
@@ -376,15 +376,43 @@
!OSProcess methodsFor:'accessing'!
-auxStream
- ^ auxStream
+auxInStream
+ ^ auxInStream
!
-auxStream:something
+auxInStream:aStream
"set an auxiliary input stream that will be available to the command as
file descriptor 3"
- auxStream := something.
+ auxInStream := aStream.
+
+ "Modified (comment): / 23-02-2017 / 10:56:57 / Maren"
+!
+
+auxOutStream
+ ^ auxOutStream
+!
+
+auxOutStream:aStream
+ "set an auxiliary output stream that will be available to the command as
+ file descriptor 4"
+
+ auxOutStream := aStream.
+
+ "Modified (comment): / 23-02-2017 / 10:56:57 / Maren"
+!
+
+auxStream
+ <resource: #obsolete>
+ ^ self auxInStream
+!
+
+auxStream:aStream
+ <resource: #obsolete>
+ "set an auxiliary input stream that will be available to the command as
+ file descriptor 3"
+
+ self auxInStream:aStream.
"Modified (comment): / 23-02-2017 / 10:56:57 / Maren"
!
@@ -437,7 +465,7 @@
"Created: / 04-11-2018 / 18:28:24 / Claus Gittinger"
!
-command:commandArg environment:environmentArg directory:directoryArg inStream:inStreamArg outStream:outStreamArg errorStream:errorStreamArg auxStream:auxStreamArg showWindow:showWindowArg lineWise:lineWiseArg
+command:commandArg environment:environmentArg directory:directoryArg inStream:inStreamArg outStream:outStreamArg errorStream:errorStreamArg auxInStream:auxInStreamArg auxOutStream:auxOutStreamArg showWindow:showWindowArg lineWise:lineWiseArg
"set the command to be executed & directory, where to execute.
and input/output streams.
See comments in individual setters for more info"
@@ -448,7 +476,24 @@
inStream := inStreamArg.
outStream := outStreamArg.
errorStream := errorStreamArg.
- auxStream := auxStreamArg.
+ auxInStream := auxInStreamArg.
+ auxOutStream := auxOutStreamArg.
+ showWindow := showWindowArg.
+ lineWise := lineWiseArg.
+!
+
+command:commandArg environment:environmentArg directory:directoryArg inStream:inStreamArg outStream:outStreamArg errorStream:errorStreamArg auxStream:auxInStreamArg showWindow:showWindowArg lineWise:lineWiseArg
+ "set the command to be executed & directory, where to execute.
+ and input/output streams.
+ See comments in individual setters for more info"
+
+ command := commandArg.
+ environment := environmentArg.
+ directory := directoryArg.
+ inStream := inStreamArg.
+ outStream := outStreamArg.
+ errorStream := errorStreamArg.
+ auxInStream := auxInStreamArg.
showWindow := showWindowArg.
lineWise := lineWiseArg.
!
@@ -866,7 +911,7 @@
procs := aProcessCollection.
procs notNil ifTrue:[
- procs do:[:eachProc | eachProc terminate].
+ procs copy do:[:eachProc | eachProc terminate].
procs removeAll.
].
@@ -969,10 +1014,16 @@
the exit fom the command interpreter/shell is done some time later
So you have to check later or set #terminateActionBlock: and check there."
- |externalInStream externalAuxStream externalErrorStream externalOutStream callingProcess|
+ |externalInStream externalAuxInStream externalErrorStream externalOutStream
+ externalAuxOutStream callingProcess|
externalInStream := self setupShufflerForInput:inStream.
- externalAuxStream := self setupShufflerForInput:auxStream.
+ auxInStream notNil ifTrue:[
+ externalAuxInStream := self setupShufflerForInput:auxInStream.
+ ].
+ auxOutStream notNil ifTrue:[
+ externalAuxOutStream := self setupShufflerForOutput:auxOutStream.
+ ].
externalOutStream := self setupShufflerForOutput:outStream.
errorStream == outStream ifTrue:[
@@ -998,7 +1049,8 @@
inputFrom:externalInStream
outputTo:externalOutStream
errorTo:externalErrorStream
- auxFrom:externalAuxStream
+ auxFrom:externalAuxInStream
+ aux2To:externalAuxOutStream
environment:environment
inDirectory:directory
newPgrp:newPgrp
@@ -1045,7 +1097,7 @@
"/ nil those references here, because there is still a home-context reference from the
"/ monitor-pid action block. Otheriwse, the garbage collector might not collect them.
- externalInStream := externalAuxStream := externalOutStream := externalErrorStream := nil.
+ externalInStream := externalAuxInStream := externalAuxOutStream := externalOutStream := externalErrorStream := nil.
pid isNil ifTrue:[
UserPreferences current logExecutedOSCommands ifTrue:[