piped shell stopping second piped shell

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

piped shell stopping second piped shell

Stephen-71
Hi everyone,

I've got a scenario where I'm using gst to run a shell command, and then
using the output to run an iteration within which is another shell command.

It looks like there could be a gst bug stopping this from working.

Here is a trivial sample (it isn't meaningful, but shows the problem):

shellCmd := 'ls -l /etc'.
filelistPipe := FileStream popen: shellCmd dir: FileStream read.
filelist := filelistPipe contents.
filelist linesDo: [ :shortname |
    shellCmd2 := 'ls /etc/skel'.
    pipe2 := FileStream popen: shellCmd2 dir: FileStream read.
    Transcript showCr: pipe2 contents.
    Transcript showCr: ' --------------------------- '.
].

The problem is that the "filelist linesDo" block doesn't loop. There is
no output from the loop.



In contrast, this code works as expected where have only changed the
loop condition: (result is 3 iterations) ...

shellCmd := 'ls -l /etc'.
filelistPipe := FileStream popen: shellCmd dir: FileStream read.
filelist := filelistPipe contents.
1 to: 3 do: [ :counter |
    shellCmd2 := 'ls /etc/skel'.
    pipe2 := FileStream popen: shellCmd2 dir: FileStream read.
    Transcript showCr: pipe2 contents.
    Transcript showCr: ' --------------------------- '.
].


And the code below works as expected where have omitted the second shell
call: ( result is as many iterations as there are lines in the "ls -l
/etc" listing) ...

shellCmd := 'ls -l /etc'.
filelistPipe := FileStream popen: shellCmd dir: FileStream read.
filelist := filelistPipe contents.
filelist linesDo: [ :shortname |
    Transcript showCr: ' --------------------------- '.
].


Am seeing this behaviour in both gst 3.0b on Mac OS X, and also in gst
3.0 (an early release) on Linux.


Thank you
Stephen


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: piped shell stopping second piped shell

Paolo Bonzini-2

> Am seeing this behaviour in both gst 3.0b on Mac OS X, and also in gst
> 3.0 (an early release) on Linux.

Me too -- interesting!...

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk