AbstractOperatingSystem.st
changeset 22179 b07f338c6338
parent 22164 33ad438fcfb2
child 22180 723fac611344
--- a/AbstractOperatingSystem.st	Wed Aug 09 14:15:20 2017 +0200
+++ b/AbstractOperatingSystem.st	Wed Aug 09 22:52:20 2017 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -1639,6 +1637,37 @@
 	onError:aBlock
 !
 
+executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream environment:environmentOrNil inDirectory:dirOrNil lineWise:lineWise showWindow:showWindow onError:aBlock
+    "execute the unix command specified by the argument, aCommandString.
+     If aCommandString is a String, the commandString is passed to a shell for execution
+     - see the description of 'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
+     If aCommandString is an Array, the first element is the command to be executed,
+     and the other elements are the arguments to the command. No shell is invoked in this case.
+     Return true if successful, the value from aBlock if not.
+     If not successfull, aBlock is called with an OsProcessStatus
+     (containing the exit status) as argument.
+     The given in, out and err streams may be arbitrary (Smalltalk-) streams;
+     if any is not an external stream (which is required by the command),
+     extra pipes and shuffler processes are created, which stuff the data into
+     those internal stream(s).
+     Nil stream args will execute the command connected to ST/X's standard input, output or
+     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:environmentOrNil
+        inDirectory:dirOrNil
+        lineWise:lineWise
+        showWindow:showWindow
+        onError:aBlock
+
+    "Created: / 09-08-2017 / 22:51:51 / cg"
+!
+
 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream environment:env onError:aBlock
     "execute the unix command specified by the argument, aCommandString.
      If aCommandString is a String, the commandString is passed to a shell for execution