[squeak-dev] debugging PipeableOSProcess

David T. Lewis lewis at mail.msen.com
Thu Mar 6 01:45:16 UTC 2008


On Wed, Mar 05, 2008 at 04:51:17PM -0600, Jimmie Houchin wrote:
> 
> I am having a very strange problem using PipeableOSProcess.
> 
> I created a method similar to below. It worked fine. Still does.
> 
> updateLocalDirectory
>     | c d p |
>     c := 'wget http://www.url.com/dir1'.
>     d := '/home/jimmie/VL/dl/'.
>     p := PipeableOSProcess command: c environment: nil workingDir: d
> input: nil output: nil error: nil errorPipelineStream: nil.
>     p closePipes
> 
> 
> I attempted to use the same method to download repositories for other
> directories on the same website. The only change was from dir1 to dir2.
> 
> Running the command in a shell with dir2 works just fine. Copying the
> command from Squeak and pasting in the shell, works fine.
> 
> But when I run the method in a workspace. Squeak just sits and waits on
> wget which at some point just stops. It doesn't exit or finish.
> 
> Sometimes if I kill the wget process, Squeak will resume working.
> Sometimes not.
> 
> Is there a way to debug such a bizarre situation. With the Squeak UI
> locked up until the method exits, I am at a loss on anything I can do.

Hi Jimmie,

If an external process is running and never exits, even though you
expect it to exit, it is probably because the external process is
blocked trying to write a lot of data to its stdout or stderr pipes
but nobody is reading data from the pipes. Once you start reading
the data, the external process will be able to proceed to completion.

Since the stdout and stderr pipes are connected to Squeak by means
of a PipeableOSProcess, this means that you will need to read the
pipes from Squeak in order to relieve the constipation. When you
run a command from a CommandShell, this happens automatically. But
if you create your own instance of PipeableOSProcess, you may need
to read the data out of these pipes in order for the external
process to reach completion.

HTH,

Dave




More information about the Squeak-dev mailing list