#DOCUMENTATION by stefan
authorStefan Vogel <sv@exept.de>
Tue, 21 Feb 2017 18:54:49 +0100
changeset 21512 a78759923d34
parent 21511 3cf003d0c399
child 21513 d4ae772134ba
#DOCUMENTATION by stefan class: OSProcess comment/format in: #examples
OSProcess.st
--- a/OSProcess.st	Tue Feb 21 18:42:24 2017 +0100
+++ b/OSProcess.st	Tue Feb 21 18:54:49 2017 +0100
@@ -34,12 +34,13 @@
 !
 
 examples
-    "
+"
+[exBegin]
         |outStream|
 
         outStream := '' writeStream.
 
-        self new 
+        OSProcess new 
             command:'ls -l';
             inStream:'abc' readStream;
             outStream:outStream;
@@ -47,14 +48,14 @@
             execute.
 
         outStream contents
-    "
+[exEnd]
 
-    "
+[exBegin]
         |outStream|
 
         outStream := '' writeStream.
 
-        self new 
+        OSProcess new 
             command:'ls -l; sleep 10; echo =================================; echo hallo after 10s; echo >&2 +++++++++++++++++++++; cat >&2';
             inStream:'abc' readStream;
             outStream:outStream;
@@ -62,14 +63,14 @@
             startProcess.
 
         outStream inspect
-    "
+[exEnd]
 
-    "
+[exBegin]
         |outStream|
 
         outStream := '' writeStream.
 
-        self new 
+        OSProcess new 
             command:'ls -l & ls -l >&2';
             inStream:'abc' readStream;
             outStream:outStream;
@@ -77,7 +78,25 @@
             startProcess.
 
         outStream inspect
-    "
+[exEnd]
+
+    Execute commands in shell/cmd.exe and read them from stdin:
+
+[exBegin]
+        |outStream|
+
+        outStream := '' writeStream.
+
+        OSProcess new 
+            command:'';
+            inStream:'ls -l' readStream;
+            outStream:outStream;
+            lineWise:true;
+            execute.
+
+        outStream contents inspect
+[exEnd]
+"
 ! !
 
 !OSProcess class methodsFor:'instance creation'!