--- a/PipeStream.st Sat Jun 14 11:09:56 2014 +0200
+++ b/PipeStream.st Sat Jun 14 11:22:57 2014 +0200
@@ -416,6 +416,29 @@
"Modified: 24.9.1997 / 09:43:23 / stefan"
! !
+!PipeStream class methodsFor:'utilities'!
+
+outputFromCommand:aCommand
+ "open a pipe reading from aCommand and return the complete output as a string.
+ If the command cannot be executed, return nil"
+
+ |p cmdOutput|
+
+ p := self readingFrom:aCommand.
+ p isNil ifTrue:[^ nil].
+
+ [
+ cmdOutput := p contentsAsString.
+ ] ensure:[
+ p close.
+ ].
+ ^ cmdOutput
+
+ "
+ PipeStream outputFromCommand:'ls -l'
+ "
+! !
+
!PipeStream methodsFor:'accessing'!
commandString
@@ -794,11 +817,11 @@
!PipeStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.115 2014-04-15 14:06:51 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.116 2014-06-14 09:22:57 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.115 2014-04-15 14:06:51 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.116 2014-06-14 09:22:57 cg Exp $'
! !