--- a/Unix.st Thu Dec 07 23:03:22 1995 +0100
+++ b/Unix.st Thu Dec 07 23:04:36 1995 +0100
@@ -13,8 +13,8 @@
Object subclass:#OperatingSystem
instanceVariableNames:''
classVariableNames:'HostName DomainName LastErrorNumber LastExecStatus OSSignals
- SlowFork ForkFailed ErrorSignal AccessDeniedErrorSignal
- FileNotFoundErrorSignal'
+ SlowFork ForkFailed ErrorSignal AccessDeniedErrorSignal
+ FileNotFoundErrorSignal'
poolDictionaries:''
category:'System-Support'
!
@@ -1893,37 +1893,6 @@
"
!
-startProcess:aCommandString
- "start executing the unix command as specified by the argument, aCommandString
- as a separate process; do not wait for the command to finish..
- The commandString is passed to a shell for execution - see the description of
- 'sh -c' in your UNIX manual.
- Return the processId if successful, nil otherwise.
- Use #waitForProcess: for synchronization and exec status return or #killProcess:
- to stop it."
-
- |id|
-
- id := self fork.
- id == 0 ifTrue:[
- "I am the child"
- self exec:'/bin/sh' withArguments:(Array with:'sh'
- with:'-c'
- with:aCommandString).
- self exit:1.
- "not reached"
- ].
- ^ id
-
- "
- |pid|
-
- pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'.
- (Delay forSeconds:3) wait.
- OperatingSystem killProcess:pid.
- "
-!
-
fork
"fork a new (HEAVY-weight) unix process.
Dont confuse this with Block>>fork, which creates
@@ -1970,6 +1939,37 @@
OperatingSystem pathOfCommand:'ls'
OperatingSystem pathOfCommand:'cvs'
"
+!
+
+startProcess:aCommandString
+ "start executing the unix command as specified by the argument, aCommandString
+ as a separate process; do not wait for the command to finish..
+ The commandString is passed to a shell for execution - see the description of
+ 'sh -c' in your UNIX manual.
+ Return the processId if successful, nil otherwise.
+ Use #waitForProcess: for synchronization and exec status return or #killProcess:
+ to stop it."
+
+ |id|
+
+ id := self fork.
+ id == 0 ifTrue:[
+ "I am the child"
+ self exec:'/bin/sh' withArguments:(Array with:'sh'
+ with:'-c'
+ with:aCommandString).
+ self exit:1.
+ "not reached"
+ ].
+ ^ id
+
+ "
+ |pid|
+
+ pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'.
+ (Delay forSeconds:3) wait.
+ OperatingSystem killProcess:pid.
+ "
! !
!OperatingSystem class methodsFor:'file access'!
@@ -3395,6 +3395,12 @@
%}
!
+killProcess:processId
+ "terminate a unix process."
+
+ self sendSignal:(self sigKILL) to:processId.
+!
+
nameForSignal:aSignalNumber
"for a given Unix signalnumber, return a descriptive string"
@@ -3486,12 +3492,6 @@
self primitiveFailed
!
-killProcess:processId
- "terminate a unix process."
-
- self sendSignal:(self sigKILL) to:processId.
-!
-
startSpyTimer
"trigger a spyInterrupt, to be signalled after some short (virtual) time.
This is used by the old MessageTally for profiling.
@@ -5251,6 +5251,6 @@
!OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.83 1995-12-04 11:15:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.84 1995-12-07 22:04:36 cg Exp $'
! !
OperatingSystem initialize!