#DOCUMENTATION by cg
authorClaus Gittinger <cg@exept.de>
Thu, 31 May 2018 08:57:29 +0200
changeset 23041 9495bc3c0d0d
parent 23040 e1ee1b6f7e66
child 23042 def1ea6ee127
#DOCUMENTATION by cg class: PipeStream class comment/format in: #outputFromCommand: #outputFromCommand:inDirectory:
PipeStream.st
--- a/PipeStream.st	Wed May 30 21:20:26 2018 +0200
+++ b/PipeStream.st	Thu May 31 08:57:29 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -282,7 +284,7 @@
         |p|
 
         p := PipeStream bidirectionalFor:'cat -u'.
-        p nextPutAll:'Wer ist der Bürgermeister von Wesel'; cr.
+        p nextPutAll:'Wer ist der Bürgermeister von Wesel'; cr.
         Transcript showCR:p nextLine.
         p close
     "
@@ -756,13 +758,16 @@
 outputFromCommand:aCommand
     "open a pipe reading from aCommand and return the complete output as a string.
      If the command cannot be executed, return nil.
-     The command's current directory will be the smalltalk current directory."
+     The command's current directory will be the smalltalk current directory.
+     Only stdout is returned; stderr is ignored (sent to /dev/null)."
 
     ^ self outputFromCommand:aCommand inDirectory:nil
 
     "
      PipeStream outputFromCommand:'ls -l'
     "
+
+    "Modified (comment): / 31-05-2018 / 08:56:06 / Claus Gittinger"
 !
 
 outputFromCommand:aCommand errorDisposition:errorDispositionSymbolOrStream inDirectory:aDirectoryOrNil
@@ -801,7 +806,7 @@
      If the command cannot be executed, return nil.
      The current directory of the command will be aDirectoryOrNil 
      or the smalltalk's current directory (if nil).
-     Any stderr output will be returned in the returned cmdOutput."
+     Any stderr output will be discarded (not included) in the returned cmdOutput."
 
     |p cmdOutput|
 
@@ -819,7 +824,10 @@
      PipeStream outputFromCommand:'ls -l' inDirectory:nil
      PipeStream outputFromCommand:'ls -l' inDirectory:'/'
      PipeStream outputFromCommand:'ls -l' inDirectory:'/etc'
+     PipeStream outputFromCommand:'echo hello >&2' inDirectory:'/etc'
     "
+
+    "Modified (comment): / 31-05-2018 / 08:57:04 / Claus Gittinger"
 ! !
 
 !PipeStream methodsFor:'accessing'!