--- a/AbstractOperatingSystem.st Wed May 19 14:16:23 1999 +0200
+++ b/AbstractOperatingSystem.st Wed May 19 14:29:49 1999 +0200
@@ -156,26 +156,28 @@
self initializeConcreteClass.
ErrorSignal isNil ifTrue:[
- ErrorSignal := Object errorSignal newSignalMayProceed:true.
- ErrorSignal nameClass:self message:#errorSignal.
- ErrorSignal notifierString:'OS error encountered'.
-
- AccessDeniedErrorSignal := ErrorSignal newSignalMayProceed:true.
- AccessDeniedErrorSignal nameClass:self message:#accessDeniedError.
- AccessDeniedErrorSignal notifierString:'OS access denied'.
-
- FileNotFoundErrorSignal := ErrorSignal newSignalMayProceed:true.
- FileNotFoundErrorSignal nameClass:self message:#fileNotFoundErrorSignal.
- FileNotFoundErrorSignal notifierString:'OS file not found'.
-
- InvalidArgumentsSignal := ErrorSignal newSignalMayProceed:true.
- InvalidArgumentsSignal nameClass:self message:#invalidArgumentsSignal.
- InvalidArgumentsSignal notifierString:'bad arg to OS call'.
-
- UnsupportedOperationSignal := ErrorSignal newSignalMayProceed:true.
- UnsupportedOperationSignal nameClass:self message:#unsupportedOperationSignal.
- UnsupportedOperationSignal notifierString:'operation not supported by OS'.
+ ErrorSignal := Object errorSignal newSignalMayProceed:true.
+ ErrorSignal nameClass:self message:#errorSignal.
+ ErrorSignal notifierString:'OS error encountered'.
+
+ AccessDeniedErrorSignal := ErrorSignal newSignalMayProceed:true.
+ AccessDeniedErrorSignal nameClass:self message:#accessDeniedError.
+ AccessDeniedErrorSignal notifierString:'OS access denied'.
+
+ FileNotFoundErrorSignal := ErrorSignal newSignalMayProceed:true.
+ FileNotFoundErrorSignal nameClass:self message:#fileNotFoundErrorSignal.
+ FileNotFoundErrorSignal notifierString:'OS file not found'.
+
+ InvalidArgumentsSignal := ErrorSignal newSignalMayProceed:true.
+ InvalidArgumentsSignal nameClass:self message:#invalidArgumentsSignal.
+ InvalidArgumentsSignal notifierString:'bad arg to OS call'.
+
+ UnsupportedOperationSignal := ErrorSignal newSignalMayProceed:true.
+ UnsupportedOperationSignal nameClass:self message:#unsupportedOperationSignal.
+ UnsupportedOperationSignal notifierString:'operation not supported by this OS'.
]
+
+ "Modified: / 19.5.1999 / 14:21:28 / cg"
!
initializeConcreteClass
@@ -1252,7 +1254,10 @@
getCommandOutputFrom:aCommand
"execute a simple command (such as hostname) and
- return the commands output as a string"
+ return the commands first line of output as a string.
+ If the command generates multiple output lines, only the first line is returned.
+ If the commands does not generate any output, an empty string is returned;
+ if the command fails, nil is returned."
|result|
@@ -1264,16 +1269,28 @@
] do:[
|p|
- p := PipeStream readingFrom:aCommand.
+ p := PipeStream
+ readingFrom:aCommand
+ errorDisposition:#discard
+ inDirectory:nil.
p notNil ifTrue:[
- result := p nextLine.
+ p atEnd ifTrue:[
+ result := ''
+ ] ifFalse:[
+ result := p nextLine.
+ ].
p close
].
].
].
^ result
- "Modified: / 19.5.1999 / 12:34:28 / cg"
+ "
+ OperatingSystem getCommandOutputFrom:'hostname'
+ OperatingSystem getCommandOutputFrom:'pwd'
+ "
+
+ "Modified: / 19.5.1999 / 14:25:02 / cg"
!
getVMSSymbol:aSymbolString
@@ -1972,37 +1989,47 @@
!AbstractOperatingSystem class methodsFor:'interprocess communication'!
createCOMFileForVMSCommand:aCommandString in:aDirectory
- ^ UnsupportedOperationSignal raiseErrorString:'not supported on this platform'
-
- "Modified: / 19.5.1999 / 12:16:04 / cg"
+ "this is only implemented/required for VMS systems, to execute commands"
+
+ ^ UnsupportedOperationSignal raise
+
"Created: / 19.5.1999 / 12:16:31 / cg"
+ "Modified: / 19.5.1999 / 14:22:05 / cg"
!
createMailBox
- ^ UnsupportedOperationSignal raiseErrorString:'not supported on this platform'
+ "this is only implemented/required for VMS systems, to emulate pipes"
+
+ ^ UnsupportedOperationSignal raise
"Created: / 19.5.1999 / 12:14:56 / cg"
- "Modified: / 19.5.1999 / 12:16:04 / cg"
+ "Modified: / 19.5.1999 / 14:22:22 / cg"
!
destroyMailBox:mbx
- ^ UnsupportedOperationSignal raiseErrorString:'not supported on this platform'
-
- "Modified: / 19.5.1999 / 12:16:04 / cg"
+ "this is only implemented/required for VMS systems, to emulate pipes"
+
+ ^ UnsupportedOperationSignal raise
+
"Created: / 19.5.1999 / 12:16:43 / cg"
+ "Modified: / 19.5.1999 / 14:22:33 / cg"
!
mailBoxNameOf:mbx
- ^ UnsupportedOperationSignal raiseErrorString:'not supported on this platform'
+ "this is only implemented/required for VMS systems, to emulate pipes"
+
+ ^ UnsupportedOperationSignal raise
"Created: / 19.5.1999 / 12:14:56 / cg"
- "Modified: / 19.5.1999 / 12:16:08 / cg"
+ "Modified: / 19.5.1999 / 14:22:40 / cg"
!
makePipe
- ^ UnsupportedOperationSignal raiseErrorString:'not supported on this platform'
-
- "Modified: / 19.5.1999 / 12:15:58 / cg"
+ "this is only implemented/required for non-VMS systems"
+
+ ^ UnsupportedOperationSignal raise
+
+ "Modified: / 19.5.1999 / 14:23:09 / cg"
! !
!AbstractOperatingSystem class methodsFor:'interrupts & signals'!
@@ -3155,18 +3182,18 @@
"low level entry to shmat()-system call.
Not supported on all operatingSystems"
- self subclassResponsibility
-
- "Modified: 22.4.1996 / 13:15:12 / cg"
+ ^ UnsupportedOperationSignal raise
+
+ "Modified: / 19.5.1999 / 14:21:35 / cg"
!
shmDetach:addr
"low level entry to shmdt()-system call.
Not supported on all operatingSystems"
- self subclassResponsibility
-
- "Modified: 22.4.1996 / 13:15:03 / cg"
+ ^ UnsupportedOperationSignal raise
+
+ "Modified: / 19.5.1999 / 14:21:37 / cg"
!
shmGet:key size:size flags:flags
@@ -3174,7 +3201,9 @@
This is not for public use and not supported with all operatingSystems.
- use the provided wrapper class SharedExternalBytes instead."
- self subclassResponsibility
+ ^ UnsupportedOperationSignal raise
+
+ "Modified: / 19.5.1999 / 14:21:41 / cg"
! !
!AbstractOperatingSystem class methodsFor:'time and date'!
@@ -3753,6 +3782,6 @@
!AbstractOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.18 1999-05-19 10:39:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.19 1999-05-19 12:29:49 cg Exp $'
! !
AbstractOperatingSystem initialize!