OSProcess.st
branchjv
changeset 21251 32f12bea6608
parent 21249 86c01ee5a76e
parent 21223 bebca95ca864
child 21252 1b7c2d5523d5
equal deleted inserted replaced
21250:f856fbfcdc60 21251:32f12bea6608
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "{ Package: 'stx:libbasic' }"
     1 "{ Package: 'stx:libbasic' }"
     4 
     2 
     5 "{ NameSpace: Smalltalk }"
     3 "{ NameSpace: Smalltalk }"
     6 
     4 
     7 Object subclass:#OSProcess
     5 Object subclass:#OSProcess
   402             priority:(Processor userSchedulingPriority "+ 1");
   400             priority:(Processor userSchedulingPriority "+ 1");
   403             name:'OSProcess output shuffler';
   401             name:'OSProcess output shuffler';
   404 "/                beSystemProcess;
   402 "/                beSystemProcess;
   405             resume.
   403             resume.
   406 
   404 
       
   405     shufflerProcesses add:shufflerProcess.
   407     streamsToClose add:externalStream.
   406     streamsToClose add:externalStream.
   408 
   407 
   409     ^ externalStream
   408     ^ externalStream
   410 ! !
   409 ! !
   411 
   410 
   488                         auxFrom:externalAuxStream
   487                         auxFrom:externalAuxStream
   489                         environment:environment
   488                         environment:environment
   490                         inDirectory:directory
   489                         inDirectory:directory
   491                         newPgrp:newPgrp
   490                         newPgrp:newPgrp
   492                         showWindow:showWindow.
   491                         showWindow:showWindow.
       
   492 
       
   493             pid
   493         ] 
   494         ] 
   494         action:[:status |
   495         action:[:status |
   495             status stillAlive ifFalse:[
   496             status stillAlive ifFalse:[
   496                 exitStatus := status.
   497                 exitStatus := status.
   497                 pid notNil ifTrue:[
   498                 pid notNil ifTrue:[
   498                     OperatingSystem closePid:pid.
   499                     OperatingSystem closePid:pid.
   499                 ].
   500                 ].
   500                 shufflerProcesses do:[:eachProcess|
   501 "/                shufflerProcesses do:[:eachProcess|
   501                     "terminate the shuffler processes.
   502 "/                    "terminate the shuffler processes.
   502                      They close the local side of the pipe when being terminated"
   503 "/                     They close the local side of the pipe when being terminated"
   503                     eachProcess terminate.
   504 "/                    eachProcess terminate.
   504                 ].
   505 "/                ].
       
   506                 finishSema signal.
   505                 terminateActionBlock value.
   507                 terminateActionBlock value.
   506                 finishSema signal.
       
   507             ].
   508             ].
   508         ].
   509         ].
   509 
   510 
   510     "we can close the remote side of the pipes after the os process has been started (after the fork)"
   511     "we can close the remote side of the pipes after the os process has been started (after the fork)"
   511     streamsToClose do:[:eachStream | eachStream close].
   512     streamsToClose do:[:eachStream | eachStream close].