Add (some) Squeak / Cuis compatibility methods to `OSProcess` jv
authorJan Vrany <jan.vrany@labware.com>
Tue, 06 Dec 2022 11:18:37 +0000
branchjv
changeset 1501 e8c33bf06ecb
parent 1500 ded9557e0bbe
child 1502 87b8e4d0225d
Add (some) Squeak / Cuis compatibility methods to `OSProcess`
Make.proto
bc.mak
extensions.st
stx_libcompat.st
--- a/Make.proto	Tue Dec 06 11:11:39 2022 +0000
+++ b/Make.proto	Tue Dec 06 11:18:37 2022 +0000
@@ -321,7 +321,7 @@
 $(OUTDIR)Win3LookPolicy.$(O) Win3LookPolicy.$(C) Win3LookPolicy.$(H): Win3LookPolicy.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libcompat/UILookPolicy.$(H) $(STCHDR)
 $(OUTDIR)ReferenceStream.$(O) ReferenceStream.$(C) ReferenceStream.$(H): ReferenceStream.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/PeekableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/PositionableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadWriteStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Stream.$(H) $(INCLUDE_TOP)/stx/libbasic/WriteStream.$(H) $(INCLUDE_TOP)/stx/libcompat/DataStream.$(H) $(INCLUDE_TOP)/stx/libcompat/RWBinaryOrTextStream.$(H) $(STCHDR)
 $(OUTDIR)VAST__Kernel.$(O) VAST__Kernel.$(C) VAST__Kernel.$(H): VAST__Kernel.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libcompat/VAST__Application.$(H) $(INCLUDE_TOP)/stx/libcompat/VAST__SubApplication.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/AbstractOperatingSystem.$(H) $(INCLUDE_TOP)/stx/libbasic/ArithmeticValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Array.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Behavior.$(H) $(INCLUDE_TOP)/stx/libbasic/Character.$(H) $(INCLUDE_TOP)/stx/libbasic/CharacterArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Class.$(H) $(INCLUDE_TOP)/stx/libbasic/ClassDescription.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/CompiledCode.$(H) $(INCLUDE_TOP)/stx/libbasic/Dictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/ExecutableFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalLibrary.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalLibraryFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalStream.$(H) $(INCLUDE_TOP)/stx/libbasic/FileStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Filename.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Integer.$(H) $(INCLUDE_TOP)/stx/libbasic/Link.$(H) $(INCLUDE_TOP)/stx/libbasic/Magnitude.$(H) $(INCLUDE_TOP)/stx/libbasic/Metaclass.$(H) $(INCLUDE_TOP)/stx/libbasic/Method.$(H) $(INCLUDE_TOP)/stx/libbasic/NonPositionableExternalStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Number.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/OrderedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/PeekableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Point.$(H) $(INCLUDE_TOP)/stx/libbasic/PositionableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Process.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadStream.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadWriteStream.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Set.$(H) $(INCLUDE_TOP)/stx/libbasic/Smalltalk.$(H) $(INCLUDE_TOP)/stx/libbasic/Stream.$(H) $(INCLUDE_TOP)/stx/libbasic/String.$(H) $(INCLUDE_TOP)/stx/libbasic/Symbol.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/WriteStream.$(H) $(INCLUDE_TOP)/stx/libbasic2/Socket.$(H) $(INCLUDE_TOP)/stx/libbasic2/ZipArchive.$(H) $(INCLUDE_TOP)/stx/libbasic3/ChangeSet.$(H) $(INCLUDE_TOP)/stx/libbasic3/ClassOrganizer.$(H) $(INCLUDE_TOP)/stx/libview/Color.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/AbstractOperatingSystem.$(H) $(INCLUDE_TOP)/stx/libbasic/ArithmeticValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Array.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Behavior.$(H) $(INCLUDE_TOP)/stx/libbasic/Character.$(H) $(INCLUDE_TOP)/stx/libbasic/CharacterArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Class.$(H) $(INCLUDE_TOP)/stx/libbasic/ClassDescription.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/CompiledCode.$(H) $(INCLUDE_TOP)/stx/libbasic/Dictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/ExecutableFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalLibrary.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalLibraryFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalStream.$(H) $(INCLUDE_TOP)/stx/libbasic/FileStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Filename.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Integer.$(H) $(INCLUDE_TOP)/stx/libbasic/Link.$(H) $(INCLUDE_TOP)/stx/libbasic/Magnitude.$(H) $(INCLUDE_TOP)/stx/libbasic/Metaclass.$(H) $(INCLUDE_TOP)/stx/libbasic/Method.$(H) $(INCLUDE_TOP)/stx/libbasic/NonPositionableExternalStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Number.$(H) $(INCLUDE_TOP)/stx/libbasic/OSProcess.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/OrderedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/PeekableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Point.$(H) $(INCLUDE_TOP)/stx/libbasic/PositionableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Process.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadStream.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadWriteStream.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Set.$(H) $(INCLUDE_TOP)/stx/libbasic/Smalltalk.$(H) $(INCLUDE_TOP)/stx/libbasic/Stream.$(H) $(INCLUDE_TOP)/stx/libbasic/String.$(H) $(INCLUDE_TOP)/stx/libbasic/Symbol.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/WriteStream.$(H) $(INCLUDE_TOP)/stx/libbasic2/Socket.$(H) $(INCLUDE_TOP)/stx/libbasic2/ZipArchive.$(H) $(INCLUDE_TOP)/stx/libbasic3/ChangeSet.$(H) $(INCLUDE_TOP)/stx/libbasic3/ClassOrganizer.$(H) $(INCLUDE_TOP)/stx/libview/Color.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/bc.mak	Tue Dec 06 11:11:39 2022 +0000
+++ b/bc.mak	Tue Dec 06 11:18:37 2022 +0000
@@ -249,7 +249,7 @@
 $(OUTDIR)Win3LookPolicy.$(O) Win3LookPolicy.$(C) Win3LookPolicy.$(H): Win3LookPolicy.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libcompat\UILookPolicy.$(H) $(STCHDR)
 $(OUTDIR)ReferenceStream.$(O) ReferenceStream.$(C) ReferenceStream.$(H): ReferenceStream.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\PeekableStream.$(H) $(INCLUDE_TOP)\stx\libbasic\PositionableStream.$(H) $(INCLUDE_TOP)\stx\libbasic\ReadWriteStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Stream.$(H) $(INCLUDE_TOP)\stx\libbasic\WriteStream.$(H) $(INCLUDE_TOP)\stx\libcompat\DataStream.$(H) $(INCLUDE_TOP)\stx\libcompat\RWBinaryOrTextStream.$(H) $(STCHDR)
 $(OUTDIR)VAST__Kernel.$(O) VAST__Kernel.$(C) VAST__Kernel.$(H): VAST__Kernel.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libcompat\VAST__Application.$(H) $(INCLUDE_TOP)\stx\libcompat\VAST__SubApplication.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\AbstractOperatingSystem.$(H) $(INCLUDE_TOP)\stx\libbasic\ArithmeticValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Array.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Behavior.$(H) $(INCLUDE_TOP)\stx\libbasic\Character.$(H) $(INCLUDE_TOP)\stx\libbasic\CharacterArray.$(H) $(INCLUDE_TOP)\stx\libbasic\Class.$(H) $(INCLUDE_TOP)\stx\libbasic\ClassDescription.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\CompiledCode.$(H) $(INCLUDE_TOP)\stx\libbasic\Dictionary.$(H) $(INCLUDE_TOP)\stx\libbasic\ExecutableFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalLibrary.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalLibraryFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalStream.$(H) $(INCLUDE_TOP)\stx\libbasic\FileStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Filename.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Integer.$(H) $(INCLUDE_TOP)\stx\libbasic\Link.$(H) $(INCLUDE_TOP)\stx\libbasic\Magnitude.$(H) $(INCLUDE_TOP)\stx\libbasic\Metaclass.$(H) $(INCLUDE_TOP)\stx\libbasic\Method.$(H) $(INCLUDE_TOP)\stx\libbasic\NonPositionableExternalStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Number.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\OrderedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\PeekableStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Point.$(H) $(INCLUDE_TOP)\stx\libbasic\PositionableStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Process.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\ReadStream.$(H) $(INCLUDE_TOP)\stx\libbasic\ReadWriteStream.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Set.$(H) $(INCLUDE_TOP)\stx\libbasic\Smalltalk.$(H) $(INCLUDE_TOP)\stx\libbasic\Stream.$(H) $(INCLUDE_TOP)\stx\libbasic\String.$(H) $(INCLUDE_TOP)\stx\libbasic\Symbol.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\WriteStream.$(H) $(INCLUDE_TOP)\stx\libbasic2\Socket.$(H) $(INCLUDE_TOP)\stx\libbasic2\ZipArchive.$(H) $(INCLUDE_TOP)\stx\libbasic3\ChangeSet.$(H) $(INCLUDE_TOP)\stx\libbasic3\ClassOrganizer.$(H) $(INCLUDE_TOP)\stx\libview\Color.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\AbstractOperatingSystem.$(H) $(INCLUDE_TOP)\stx\libbasic\ArithmeticValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Array.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Behavior.$(H) $(INCLUDE_TOP)\stx\libbasic\Character.$(H) $(INCLUDE_TOP)\stx\libbasic\CharacterArray.$(H) $(INCLUDE_TOP)\stx\libbasic\Class.$(H) $(INCLUDE_TOP)\stx\libbasic\ClassDescription.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\CompiledCode.$(H) $(INCLUDE_TOP)\stx\libbasic\Dictionary.$(H) $(INCLUDE_TOP)\stx\libbasic\ExecutableFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalLibrary.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalLibraryFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalStream.$(H) $(INCLUDE_TOP)\stx\libbasic\FileStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Filename.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Integer.$(H) $(INCLUDE_TOP)\stx\libbasic\Link.$(H) $(INCLUDE_TOP)\stx\libbasic\Magnitude.$(H) $(INCLUDE_TOP)\stx\libbasic\Metaclass.$(H) $(INCLUDE_TOP)\stx\libbasic\Method.$(H) $(INCLUDE_TOP)\stx\libbasic\NonPositionableExternalStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Number.$(H) $(INCLUDE_TOP)\stx\libbasic\OSProcess.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\OrderedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\PeekableStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Point.$(H) $(INCLUDE_TOP)\stx\libbasic\PositionableStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Process.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\ReadStream.$(H) $(INCLUDE_TOP)\stx\libbasic\ReadWriteStream.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Set.$(H) $(INCLUDE_TOP)\stx\libbasic\Smalltalk.$(H) $(INCLUDE_TOP)\stx\libbasic\Stream.$(H) $(INCLUDE_TOP)\stx\libbasic\String.$(H) $(INCLUDE_TOP)\stx\libbasic\Symbol.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\WriteStream.$(H) $(INCLUDE_TOP)\stx\libbasic2\Socket.$(H) $(INCLUDE_TOP)\stx\libbasic2\ZipArchive.$(H) $(INCLUDE_TOP)\stx\libbasic3\ChangeSet.$(H) $(INCLUDE_TOP)\stx\libbasic3\ClassOrganizer.$(H) $(INCLUDE_TOP)\stx\libview\Color.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/extensions.st	Tue Dec 06 11:11:39 2022 +0000
+++ b/extensions.st	Tue Dec 06 11:18:37 2022 +0000
@@ -1642,6 +1642,40 @@
     ^ self rounded printString
 ! !
 
+!OSProcess methodsFor:'Compatibility-Squeak'!
+
+isComplete
+    ^ self isDead
+
+    "Created: / 05-12-2022 / 16:07:23 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
+!OSProcess methodsFor:'Compatibility-Squeak'!
+
+isRunning
+    ^ self isAlive
+
+    "Created: / 05-12-2022 / 16:07:13 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
+!OSProcess class methodsFor:'Compatibility-Squeak'!
+
+command: aString
+    "Run a command in a shell process. Similar to the system(3) call in the standard C library,
+     except that aCommandString runs asynchronously in a child process."
+
+    ^ self new 
+        command: aString;
+        startProcess;
+        yourself.
+
+    "
+    OSProcess command: 'ls -al'
+    "
+
+    "Created: / 05-12-2022 / 16:00:12 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
 !Object methodsFor:'Compatibility-Squeak'!
 
 becomeForward:anotherObject
--- a/stx_libcompat.st	Tue Dec 06 11:11:39 2022 +0000
+++ b/stx_libcompat.st	Tue Dec 06 11:18:37 2022 +0000
@@ -592,6 +592,9 @@
         Filename readStreamDo:
         Filename writeStreamDo:
         'AbstractOperatingSystem class' runCommand:
+        OSProcess isComplete
+        OSProcess isRunning
+        'OSProcess class' command:
     )
 ! !