--- a/AbstractOperatingSystem.st Mon Mar 23 16:15:46 2015 +0100
+++ b/AbstractOperatingSystem.st Mon Mar 23 16:44:01 2015 +0100
@@ -232,15 +232,15 @@
"/ protect against double initialization
ErrorSignal isNil ifTrue:[
- self initializeConcreteClass.
-
- OSErrorHolder initialize.
- ErrorSignal := OsError.
- InvalidArgumentsSignal := OsInvalidArgumentsError.
- AccessDeniedErrorSignal := OSErrorHolder noPermissionsSignal.
- FileNotFoundErrorSignal := OSErrorHolder nonexistentSignal.
- UnsupportedOperationSignal := OSErrorHolder unsupportedOperationSignal.
- Smalltalk addDependent:self. "/ to catch language changes
+ self initializeConcreteClass.
+
+ OSErrorHolder initialize.
+ ErrorSignal := OsError.
+ InvalidArgumentsSignal := OsInvalidArgumentsError.
+ AccessDeniedErrorSignal := OSErrorHolder noPermissionsSignal.
+ FileNotFoundErrorSignal := OSErrorHolder nonexistentSignal.
+ UnsupportedOperationSignal := OSErrorHolder unsupportedOperationSignal.
+ Smalltalk addDependent:self. "/ to catch language changes
].
!
@@ -1094,15 +1094,15 @@
Return true if successful, false otherwise."
^ self
- executeCommand:aCommandString
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- auxFrom:nil
- environment:nil
- inDirectory:nil
- lineWise:false
- onError:[:status| false]
+ executeCommand:aCommandString
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ auxFrom:nil
+ environment:nil
+ inDirectory:nil
+ lineWise:false
+ onError:[:status| false]
"unix:
@@ -1139,15 +1139,15 @@
Return true if successful, false otherwise."
^ self
- executeCommand:aCommandString
- inputFrom:nil
- outputTo:nil
- errorTo:errorStream
- auxFrom:nil
- environment:nil
- inDirectory:nil
- lineWise:false
- onError:[:status| false]
+ executeCommand:aCommandString
+ inputFrom:nil
+ outputTo:nil
+ errorTo:errorStream
+ auxFrom:nil
+ environment:nil
+ inDirectory:nil
+ lineWise:false
+ onError:[:status| false]
"unix:
@@ -1166,15 +1166,15 @@
Return true if successful, false otherwise."
^ self
- executeCommand:aCommandString
- inputFrom:nil
- outputTo:nil
- errorTo:errorStream
- auxFrom:nil
- environment:nil
- inDirectory:aDirectory
- lineWise:false
- onError:[:status| false]
+ executeCommand:aCommandString
+ inputFrom:nil
+ outputTo:nil
+ errorTo:errorStream
+ auxFrom:nil
+ environment:nil
+ inDirectory:aDirectory
+ lineWise:false
+ onError:[:status| false]
"unix:
@@ -1195,15 +1195,15 @@
Return true if successful, false otherwise."
^ self
- executeCommand:aCommandString
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- auxFrom:nil
- environment:nil
- inDirectory:aDirectory
- lineWise:false
- onError:[:exitStatus| false]
+ executeCommand:aCommandString
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ auxFrom:nil
+ environment:nil
+ inDirectory:aDirectory
+ lineWise:false
+ onError:[:exitStatus| false]
"Modified: / 10.11.1998 / 20:54:37 / cg"
!
@@ -1219,15 +1219,15 @@
(containing the exit status) as argument."
^ self
- executeCommand:aCommandString
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- auxFrom:nil
- environment:nil
- inDirectory:aDirectory
- lineWise:false
- onError:aBlock
+ executeCommand:aCommandString
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ auxFrom:nil
+ environment:nil
+ inDirectory:aDirectory
+ lineWise:false
+ onError:aBlock
"Modified: / 10.11.1998 / 20:54:37 / cg"
!
@@ -1241,70 +1241,70 @@
Return true if successful, false if not."
^ self
- executeCommand:aCommandString
- inputFrom:anInStream
- outputTo:anOutStream
- errorTo:anErrStream
- auxFrom:nil
- environment:nil
- inDirectory:nil
- lineWise:false
- onError:[:status | false]
-
- "
- OperatingSystem
- executeCommand:'ls'
- inputFrom:nil
- outputTo:Transcript
- errorTo:Transcript
-
- |s|
- s := WriteStream on:''.
- (OperatingSystem
- executeCommand:'ls'
- inputFrom:nil
- outputTo:s
- errorTo:Transcript) ifTrue:[Transcript showCR:s contents]
-
- OperatingSystem
- executeCommand:'dir'
- inputFrom:nil
- outputTo:Transcript
- errorTo:Transcript
-
- OperatingSystem
- executeCommand:'foo'
- inputFrom:Transcript
- outputTo:Transcript
- errorTo:nil
- "
- "
- |outStr errStr|
-
- outStr := '' writeStream.
- errStr := '' writeStream.
- OperatingSystem
- executeCommand:'ls'
- inputFrom:nil
- outputTo:outStr
- errorTo:errStr
- onError:[:status | Transcript flash].
- Transcript show:'out:'; showCR:outStr contents.
- Transcript show:'err:'; showCR:errStr contents.
- "
- "
- |outStr errStr|
-
- outStr := '' writeStream.
- errStr := '' writeStream.
- OperatingSystem
- executeCommand:'ls /fooBar'
- inputFrom:nil
- outputTo:outStr
- errorTo:errStr
- onError:[:status | Transcript flash].
- Transcript show:'out:'; showCR:outStr contents.
- Transcript show:'err:'; showCR:errStr contents.
+ executeCommand:aCommandString
+ inputFrom:anInStream
+ outputTo:anOutStream
+ errorTo:anErrStream
+ auxFrom:nil
+ environment:nil
+ inDirectory:nil
+ lineWise:false
+ onError:[:status | false]
+
+ "
+ OperatingSystem
+ executeCommand:'ls'
+ inputFrom:nil
+ outputTo:Transcript
+ errorTo:Transcript
+
+ |s|
+ s := WriteStream on:''.
+ (OperatingSystem
+ executeCommand:'ls'
+ inputFrom:nil
+ outputTo:s
+ errorTo:Transcript) ifTrue:[Transcript showCR:s contents]
+
+ OperatingSystem
+ executeCommand:'dir'
+ inputFrom:nil
+ outputTo:Transcript
+ errorTo:Transcript
+
+ OperatingSystem
+ executeCommand:'foo'
+ inputFrom:Transcript
+ outputTo:Transcript
+ errorTo:nil
+ "
+ "
+ |outStr errStr|
+
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'ls'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | Transcript flash].
+ Transcript show:'out:'; showCR:outStr contents.
+ Transcript show:'err:'; showCR:errStr contents.
+ "
+ "
+ |outStr errStr|
+
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'ls /fooBar'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | Transcript flash].
+ Transcript show:'out:'; showCR:outStr contents.
+ Transcript show:'err:'; showCR:errStr contents.
"
"Modified: / 10.11.1998 / 20:51:39 / cg"
@@ -1342,244 +1342,244 @@
terminateLock := Semaphore forMutualExclusion.
((externalInStream := anInStream) notNil
and:[externalInStream isExternalStream not]) ifTrue:[
- pIn := NonPositionableExternalStream makePipe.
- inStreamToClose := externalInStream := pIn at:1.
- shuffledInStream := pIn at:2.
- anInStream isBinary ifTrue:[
- shuffledInStream binary
- ].
- lineWise ifFalse:[
- shuffledInStream blocking:false.
- ].
-
- "/ start a reader process, shuffling data from the given
- "/ inStream to the pipe (which is connected to the commands input)
- inputShufflerProcess :=
- [
- [
- [anInStream atEnd] whileFalse:[
- self shuffleFrom:anInStream to:shuffledInStream lineWise:lineWise.
- shuffledInStream flush
- ]
- ] ensure:[
- shuffledInStream close
- ]
- ] newProcess
- name:'cmd input shuffler';
+ pIn := NonPositionableExternalStream makePipe.
+ inStreamToClose := externalInStream := pIn at:1.
+ shuffledInStream := pIn at:2.
+ anInStream isBinary ifTrue:[
+ shuffledInStream binary
+ ].
+ lineWise ifFalse:[
+ shuffledInStream blocking:false.
+ ].
+
+ "/ start a reader process, shuffling data from the given
+ "/ inStream to the pipe (which is connected to the commands input)
+ inputShufflerProcess :=
+ [
+ [
+ [anInStream atEnd] whileFalse:[
+ self shuffleFrom:anInStream to:shuffledInStream lineWise:lineWise.
+ shuffledInStream flush
+ ]
+ ] ensure:[
+ shuffledInStream close
+ ]
+ ] newProcess
+ name:'cmd input shuffler';
"/ beSystemProcess;
- resume.
+ resume.
].
((externalOutStream := anOutStream) notNil
and:[externalOutStream isExternalStream not]) ifTrue:[
- pOut := NonPositionableExternalStream makePipe.
- shuffledOutStream := (pOut at:1).
- anOutStream isBinary ifTrue:[
- shuffledOutStream binary
- ].
- outStreamToClose := externalOutStream := pOut at:2.
- outputShufflerProcess :=
- [
- WriteError handle:[:ex |
- "/ ignored
- ] do:[
- self shuffleAllFrom:shuffledOutStream to:anOutStream lineWise:lineWise lockWith:terminateLock.
- ].
- ] newProcess
- priority:(Processor userSchedulingPriority + 1);
- name:'cmd output shuffler';
+ pOut := NonPositionableExternalStream makePipe.
+ shuffledOutStream := (pOut at:1).
+ anOutStream isBinary ifTrue:[
+ shuffledOutStream binary
+ ].
+ outStreamToClose := externalOutStream := pOut at:2.
+ outputShufflerProcess :=
+ [
+ WriteError handle:[:ex |
+ "/ ignored
+ ] do:[
+ self shuffleAllFrom:shuffledOutStream to:anOutStream lineWise:lineWise lockWith:terminateLock.
+ ].
+ ] newProcess
+ priority:(Processor userSchedulingPriority + 1);
+ name:'cmd output shuffler';
"/ beSystemProcess;
- resume.
+ resume.
].
(externalErrStream := anErrStream) notNil ifTrue:[
- anErrStream == anOutStream ifTrue:[
- externalErrStream := externalOutStream
- ] ifFalse:[
- anErrStream isExternalStream ifFalse:[
- pErr := NonPositionableExternalStream makePipe.
- shuffledErrStream := (pErr at:1).
- anErrStream isBinary ifTrue:[
- shuffledErrStream binary
- ].
- errStreamToClose := externalErrStream := pErr at:2.
- errorShufflerProcess :=
- [
- self shuffleAllFrom:shuffledErrStream to:anErrStream lineWise:lineWise lockWith:terminateLock.
- ] newProcess
- priority:(Processor userSchedulingPriority + 2);
- name:'cmd err-output shuffler';
+ anErrStream == anOutStream ifTrue:[
+ externalErrStream := externalOutStream
+ ] ifFalse:[
+ anErrStream isExternalStream ifFalse:[
+ pErr := NonPositionableExternalStream makePipe.
+ shuffledErrStream := (pErr at:1).
+ anErrStream isBinary ifTrue:[
+ shuffledErrStream binary
+ ].
+ errStreamToClose := externalErrStream := pErr at:2.
+ errorShufflerProcess :=
+ [
+ self shuffleAllFrom:shuffledErrStream to:anErrStream lineWise:lineWise lockWith:terminateLock.
+ ] newProcess
+ priority:(Processor userSchedulingPriority + 2);
+ name:'cmd err-output shuffler';
"/ beSystemProcess;
- resume.
- ]
- ]
+ resume.
+ ]
+ ]
].
((externalAuxStream := anAuxStream) notNil
and:[externalAuxStream isExternalStream not]) ifTrue:[
- pAux := NonPositionableExternalStream makePipe.
- auxStreamToClose := externalAuxStream := pAux at:1.
- shuffledAuxStream := pAux at:2.
- shuffledAuxStream blocking:false.
- anAuxStream isBinary ifTrue:[
- shuffledAuxStream binary
- ].
-
- "/ start a reader process, shuffling data from the given
- "/ auxStream to the pipe (which is connected to the commands aux)
- auxShufflerProcess :=
- [
- [
- [anAuxStream atEnd] whileFalse:[
- self shuffleFrom:anAuxStream to:shuffledAuxStream lineWise:false.
- shuffledAuxStream flush
- ]
- ] ensure:[
- shuffledAuxStream close
- ]
- ] newProcess
- name:'cmd aux shuffler';
+ pAux := NonPositionableExternalStream makePipe.
+ auxStreamToClose := externalAuxStream := pAux at:1.
+ shuffledAuxStream := pAux at:2.
+ shuffledAuxStream blocking:false.
+ anAuxStream isBinary ifTrue:[
+ shuffledAuxStream binary
+ ].
+
+ "/ start a reader process, shuffling data from the given
+ "/ auxStream to the pipe (which is connected to the commands aux)
+ auxShufflerProcess :=
+ [
+ [
+ [anAuxStream atEnd] whileFalse:[
+ self shuffleFrom:anAuxStream to:shuffledAuxStream lineWise:false.
+ shuffledAuxStream flush
+ ]
+ ] ensure:[
+ shuffledAuxStream close
+ ]
+ ] newProcess
+ name:'cmd aux shuffler';
"/ beSystemProcess;
- resume.
+ resume.
].
stopShufflers := [:shuffleRest |
- inputShufflerProcess notNil ifTrue:[
- terminateLock critical:[inputShufflerProcess terminate].
- inputShufflerProcess waitUntilTerminated
- ].
- auxShufflerProcess notNil ifTrue:[
- terminateLock critical:[auxShufflerProcess terminate].
- auxShufflerProcess waitUntilTerminated
- ].
- outputShufflerProcess notNil ifTrue:[
- terminateLock critical:[outputShufflerProcess terminate].
- outputShufflerProcess waitUntilTerminated.
- shuffleRest ifTrue:[ self shuffleRestFrom:shuffledOutStream to:anOutStream lineWise:lineWise ].
- shuffledOutStream close.
- ].
- errorShufflerProcess notNil ifTrue:[
- terminateLock critical:[errorShufflerProcess terminate].
- errorShufflerProcess waitUntilTerminated.
- shuffleRest ifTrue:[ self shuffleRestFrom:shuffledErrStream to:anErrStream lineWise:lineWise ].
- shuffledErrStream close.
- ].
- ].
+ inputShufflerProcess notNil ifTrue:[
+ terminateLock critical:[inputShufflerProcess terminate].
+ inputShufflerProcess waitUntilTerminated
+ ].
+ auxShufflerProcess notNil ifTrue:[
+ terminateLock critical:[auxShufflerProcess terminate].
+ auxShufflerProcess waitUntilTerminated
+ ].
+ outputShufflerProcess notNil ifTrue:[
+ terminateLock critical:[outputShufflerProcess terminate].
+ outputShufflerProcess waitUntilTerminated.
+ shuffleRest ifTrue:[ self shuffleRestFrom:shuffledOutStream to:anOutStream lineWise:lineWise ].
+ shuffledOutStream close.
+ ].
+ errorShufflerProcess notNil ifTrue:[
+ terminateLock critical:[errorShufflerProcess terminate].
+ errorShufflerProcess waitUntilTerminated.
+ shuffleRest ifTrue:[ self shuffleRestFrom:shuffledErrStream to:anErrStream lineWise:lineWise ].
+ shuffledErrStream close.
+ ].
+ ].
closeStreams := [
- inStreamToClose notNil ifTrue:[
- inStreamToClose close
- ].
- errStreamToClose notNil ifTrue:[
- errStreamToClose close
- ].
- outStreamToClose notNil ifTrue:[
- outStreamToClose close
- ].
- auxStreamToClose notNil ifTrue:[
- auxStreamToClose close
- ].
- nullStream notNil ifTrue:[
- nullStream close
- ].
- ].
+ inStreamToClose notNil ifTrue:[
+ inStreamToClose close
+ ].
+ errStreamToClose notNil ifTrue:[
+ errStreamToClose close
+ ].
+ outStreamToClose notNil ifTrue:[
+ outStreamToClose close
+ ].
+ auxStreamToClose notNil ifTrue:[
+ auxStreamToClose close
+ ].
+ nullStream notNil ifTrue:[
+ nullStream close
+ ].
+ ].
sema := Semaphore new name:'OS command wait'.
[
- externalInStream isNil ifTrue:[
- externalInStream := nullStream := Filename nullDevice readWriteStream.
- ].
- externalOutStream isNil ifTrue:[
- nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
- externalOutStream := nullStream.
- ].
- externalErrStream isNil ifTrue:[
- externalErrStream := externalOutStream
- ].
-
- pid := Processor
- monitor:[
- self
- startProcess:aCommandStringOrArray
- inputFrom:externalInStream
- outputTo:externalOutStream
- errorTo:externalErrStream
- auxFrom:externalAuxStream
- environment:environmentDictionary
- inDirectory:dirOrNil
- ]
- action:[:status |
- status stillAlive ifFalse:[
- exitStatus := status.
- sema signal.
- self closePid:pid
- ]
- ].
-
- pid isNil ifTrue:[
- exitStatus := self osProcessStatusClass processCreationFailure
- ] ifFalse:[
- sema wait.
- ].
+ externalInStream isNil ifTrue:[
+ externalInStream := nullStream := Filename nullDevice readWriteStream.
+ ].
+ externalOutStream isNil ifTrue:[
+ nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
+ externalOutStream := nullStream.
+ ].
+ externalErrStream isNil ifTrue:[
+ externalErrStream := externalOutStream
+ ].
+
+ pid := Processor
+ monitor:[
+ self
+ startProcess:aCommandStringOrArray
+ inputFrom:externalInStream
+ outputTo:externalOutStream
+ errorTo:externalErrStream
+ auxFrom:externalAuxStream
+ environment:environmentDictionary
+ inDirectory:dirOrNil
+ ]
+ action:[:status |
+ status stillAlive ifFalse:[
+ exitStatus := status.
+ sema signal.
+ self closePid:pid
+ ]
+ ].
+
+ pid isNil ifTrue:[
+ exitStatus := self osProcessStatusClass processCreationFailure
+ ] ifFalse:[
+ sema wait.
+ ].
] ifCurtailed:[
- closeStreams value.
- pid notNil ifTrue:[
- "/ terminate the os-command (and all of its forked commands)
- self terminateProcessGroup:pid.
- self terminateProcess:pid.
- self closePid:pid.
- ].
- stopShufflers value:false.
+ closeStreams value.
+ pid notNil ifTrue:[
+ "/ terminate the os-command (and all of its forked commands)
+ self terminateProcessGroup:pid.
+ self terminateProcess:pid.
+ self closePid:pid.
+ ].
+ stopShufflers value:false.
].
closeStreams value.
stopShufflers value:true.
(exitStatus isNil or:[exitStatus success]) ifFalse:[
- ^ aBlock value:exitStatus
+ ^ aBlock value:exitStatus
].
^ true
"
- |outStream errStream|
-
- outStream := '' writeStream.
-
- OperatingSystem executeCommand:'ls -l'
- inputFrom:'abc' readStream
- outputTo:outStream
- errorTo:nil
- inDirectory:nil
- lineWise:true
- onError:[:exitStatus | ^ false].
- outStream contents
- "
-
- "
- |outStream errStream|
-
- outStream := #[] writeStream.
-
- OperatingSystem executeCommand:'cat'
- inputFrom:(ByteArray new:5000000) readStream
- outputTo:outStream
- errorTo:nil
- inDirectory:nil
- lineWise:false
- onError:[:exitStatus | ^ false].
- outStream size
- "
-
- "
- |outStream errStream|
-
- outStream := '' writeStream.
-
- OperatingSystem executeCommand:'gpg -s --batch --no-tty --passphrase-fd 0 /tmp/passwd'
- inputFrom:'bla' readStream
- outputTo:outStream
- errorTo:nil
- inDirectory:nil
- lineWise:true
- onError:[:exitStatus | false].
- outStream contents
+ |outStream errStream|
+
+ outStream := '' writeStream.
+
+ OperatingSystem executeCommand:'ls -l'
+ inputFrom:'abc' readStream
+ outputTo:outStream
+ errorTo:nil
+ inDirectory:nil
+ lineWise:true
+ onError:[:exitStatus | ^ false].
+ outStream contents
+ "
+
+ "
+ |outStream errStream|
+
+ outStream := #[] writeStream.
+
+ OperatingSystem executeCommand:'cat'
+ inputFrom:(ByteArray new:5000000) readStream
+ outputTo:outStream
+ errorTo:nil
+ inDirectory:nil
+ lineWise:false
+ onError:[:exitStatus | ^ false].
+ outStream size
+ "
+
+ "
+ |outStream errStream|
+
+ outStream := '' writeStream.
+
+ OperatingSystem executeCommand:'gpg -s --batch --no-tty --passphrase-fd 0 /tmp/passwd'
+ inputFrom:'bla' readStream
+ outputTo:outStream
+ errorTo:nil
+ inDirectory:nil
+ lineWise:true
+ onError:[:exitStatus | false].
+ outStream contents
"
"Modified: / 11-02-2007 / 20:54:39 / cg"
@@ -1609,58 +1609,58 @@
(containing the exit status) as argument."
^ self
- executeCommand:aCommandString
- inputFrom:anInStream
- outputTo:anOutStream
- errorTo:anErrStream
- auxFrom:nil
- environment:env
- inDirectory:nil
- lineWise:false
- onError:aBlock
-
- "
- OperatingSystem
- executeCommand:'dir'
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- onError:[:status | Transcript flash]
-
- OperatingSystem
- executeCommand:'foo'
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- onError:[:status | Transcript flash]
- "
- "
- |outStr errStr|
-
- outStr := '' writeStream.
- errStr := '' writeStream.
- OperatingSystem
- executeCommand:'ls'
- inputFrom:nil
- outputTo:outStr
- errorTo:errStr
- onError:[:status | Transcript flash].
- Transcript show:'out:'; showCR:outStr contents.
- Transcript show:'err:'; showCR:errStr contents.
- "
- "
- |outStr errStr|
-
- outStr := '' writeStream.
- errStr := '' writeStream.
- OperatingSystem
- executeCommand:'ls /fooBar'
- inputFrom:nil
- outputTo:outStr
- errorTo:errStr
- onError:[:status | Transcript flash].
- Transcript show:'out:'; showCR:outStr contents.
- Transcript show:'err:'; showCR:errStr contents.
+ executeCommand:aCommandString
+ inputFrom:anInStream
+ outputTo:anOutStream
+ errorTo:anErrStream
+ auxFrom:nil
+ environment:env
+ inDirectory:nil
+ lineWise:false
+ onError:aBlock
+
+ "
+ OperatingSystem
+ executeCommand:'dir'
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ onError:[:status | Transcript flash]
+
+ OperatingSystem
+ executeCommand:'foo'
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ onError:[:status | Transcript flash]
+ "
+ "
+ |outStr errStr|
+
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'ls'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | Transcript flash].
+ Transcript show:'out:'; showCR:outStr contents.
+ Transcript show:'err:'; showCR:errStr contents.
+ "
+ "
+ |outStr errStr|
+
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'ls /fooBar'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | Transcript flash].
+ Transcript show:'out:'; showCR:outStr contents.
+ Transcript show:'err:'; showCR:errStr contents.
"
"Modified: / 10.11.1998 / 20:51:39 / cg"
@@ -1711,15 +1711,15 @@
error resp. - i.e. usually, i/o will be from/to the terminal"
^ self
- executeCommand:aCommandString
- inputFrom:anInStream
- outputTo:anOutStream
- errorTo:anErrStream
- auxFrom:nil
- environment:nil
- inDirectory:dirOrNil
- lineWise:lineWise
- onError:aBlock
+ executeCommand:aCommandString
+ inputFrom:anInStream
+ outputTo:anOutStream
+ errorTo:anErrStream
+ auxFrom:nil
+ environment:nil
+ inDirectory:dirOrNil
+ lineWise:lineWise
+ onError:aBlock
!
executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream inDirectory:dirOrNil onError:aBlock
@@ -1739,51 +1739,51 @@
error resp. - i.e. i/o will be from/to the xterminal"
^ self
- executeCommand:aCommandString
- inputFrom:anInStream
- outputTo:anOutStream
- errorTo:anErrStream
- auxFrom:nil
- environment:nil
- inDirectory:dirOrNil
- lineWise:false
- onError:aBlock
+ executeCommand:aCommandString
+ inputFrom:anInStream
+ outputTo:anOutStream
+ errorTo:anErrStream
+ auxFrom:nil
+ environment:nil
+ inDirectory:dirOrNil
+ lineWise:false
+ onError:aBlock
"
OperatingSystem
- executeCommand:'dir'
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- inDirectory:'c:'
- onError:[:status | Transcript flash]
+ executeCommand:'dir'
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ inDirectory:'c:'
+ onError:[:status | Transcript flash]
OperatingSystem
- executeCommand:'foo'
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- inDirectory:'/etc'
- onError:[:status | Transcript flash]
+ executeCommand:'foo'
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ inDirectory:'/etc'
+ onError:[:status | Transcript flash]
|s|
s := '' writeStream.
OperatingSystem
- executeCommand:'ls -l'
- inputFrom:nil
- outputTo:s
- errorTo:nil
- onError:[:status | Transcript flash].
+ executeCommand:'ls -l'
+ inputFrom:nil
+ outputTo:s
+ errorTo:nil
+ onError:[:status | Transcript flash].
Transcript showCR:s contents.
|s|
s := '' writeStream.
OperatingSystem
- executeCommand:'sh foo'
- inputFrom:nil
- outputTo:s
- errorTo:s
- onError:[:status | Transcript flash].
+ executeCommand:'sh foo'
+ inputFrom:nil
+ outputTo:s
+ errorTo:s
+ onError:[:status | Transcript flash].
Transcript showCR:s contents.
"
@@ -1804,58 +1804,58 @@
(containing the exit status) as argument."
^ self
- executeCommand:aCommandString
- inputFrom:anInStream
- outputTo:anOutStream
- errorTo:anErrStream
- auxFrom:nil
- environment:nil
- inDirectory:nil
- lineWise:false
- onError:aBlock
-
- "
- OperatingSystem
- executeCommand:'dir'
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- onError:[:status | Transcript flash]
-
- OperatingSystem
- executeCommand:'foo'
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- onError:[:status | Transcript flash]
- "
- "
- |outStr errStr|
-
- outStr := '' writeStream.
- errStr := '' writeStream.
- OperatingSystem
- executeCommand:'ls'
- inputFrom:nil
- outputTo:outStr
- errorTo:errStr
- onError:[:status | Transcript flash].
- Transcript show:'out:'; showCR:outStr contents.
- Transcript show:'err:'; showCR:errStr contents.
- "
- "
- |outStr errStr|
-
- outStr := '' writeStream.
- errStr := '' writeStream.
- OperatingSystem
- executeCommand:'ls /fooBar'
- inputFrom:nil
- outputTo:outStr
- errorTo:errStr
- onError:[:status | Transcript flash].
- Transcript show:'out:'; showCR:outStr contents.
- Transcript show:'err:'; showCR:errStr contents.
+ executeCommand:aCommandString
+ inputFrom:anInStream
+ outputTo:anOutStream
+ errorTo:anErrStream
+ auxFrom:nil
+ environment:nil
+ inDirectory:nil
+ lineWise:false
+ onError:aBlock
+
+ "
+ OperatingSystem
+ executeCommand:'dir'
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ onError:[:status | Transcript flash]
+
+ OperatingSystem
+ executeCommand:'foo'
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ onError:[:status | Transcript flash]
+ "
+ "
+ |outStr errStr|
+
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'ls'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | Transcript flash].
+ Transcript show:'out:'; showCR:outStr contents.
+ Transcript show:'err:'; showCR:errStr contents.
+ "
+ "
+ |outStr errStr|
+
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'ls /fooBar'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | Transcript flash].
+ Transcript show:'out:'; showCR:outStr contents.
+ Transcript show:'err:'; showCR:errStr contents.
"
"Modified: / 10.11.1998 / 20:51:39 / cg"
@@ -1872,15 +1872,15 @@
(containing the exit status) as argument."
^ self
- executeCommand:aCommandString
- inputFrom:nil
- outputTo:nil
- errorTo:nil
- auxFrom:nil
- environment:nil
- inDirectory:nil
- lineWise:false
- onError:aBlock
+ executeCommand:aCommandString
+ inputFrom:nil
+ outputTo:nil
+ errorTo:nil
+ auxFrom:nil
+ environment:nil
+ inDirectory:nil
+ lineWise:false
+ onError:aBlock
"unix:
@@ -1910,27 +1910,27 @@
Return true if successful, false otherwise."
^ self
- executeCommand:aCommandString
- inputFrom:nil
- outputTo:anOutStreamOrNil
- errorTo:nil
- auxFrom:nil
- environment:nil
- inDirectory:nil
- lineWise:false
- onError:[:status| false]
+ executeCommand:aCommandString
+ inputFrom:nil
+ outputTo:anOutStreamOrNil
+ errorTo:nil
+ auxFrom:nil
+ environment:nil
+ inDirectory:nil
+ lineWise:false
+ onError:[:status| false]
"
String streamContents:[:s|OperatingSystem
- executeCommand:'ls'
- outputTo:s
+ executeCommand:'ls'
+ outputTo:s
]
"
"
String streamContents:[:s|OperatingSystem
- executeCommand:'pwd'
- outputTo:s
+ executeCommand:'pwd'
+ outputTo:s
]
"
!
@@ -4016,6 +4016,9 @@
# ifdef VMS
# define PLATFORM_DEFINE "-DVMS"
# endif
+# ifdef __osx__
+# define PLATFORM_DEFINE "-D__osx__"
+# endif
# ifdef OSX
# define PLATFORM_DEFINE "-DOSX"
# endif
@@ -4154,7 +4157,7 @@
isLinuxLike
"return true, if the OS we're running on is a linux."
-
+
^ false
!
@@ -5893,17 +5896,17 @@
computeUTCTimeAndDateFrom:osTime
"given an OS-dependent time in osTime, return an Array
containing:
- (full-) year,
- month, (1..)
- day, (1..)
- hour, (0..23)
- minute (0..59)
- seconds, (0..59)
- offset to UTC, (seconds)
- daylight savings time flag,
- milliseconds, (0..999)
- dayInYear (1..)
- dayInWeek (1..).
+ (full-) year,
+ month, (1..)
+ day, (1..)
+ hour, (0..23)
+ minute (0..59)
+ seconds, (0..59)
+ offset to UTC, (seconds)
+ daylight savings time flag,
+ milliseconds, (0..999)
+ dayInYear (1..)
+ dayInWeek (1..).
Conversion is to utc."
^ self timeInfoFromSeconds:(osTime // 1000) milliseconds:(osTime \\ 1000) localTime:false.
@@ -6221,7 +6224,7 @@
^ (self computeTimeAndDateFrom:0) utcOffset
"
- OperatingSystem utcOffset
+ OperatingSystem utcOffset
"
! !
@@ -7698,11 +7701,11 @@
!AbstractOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.292 2015-03-02 23:12:59 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.293 2015-03-23 15:44:01 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.292 2015-03-02 23:12:59 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.293 2015-03-23 15:44:01 cg Exp $'
! !