[squeak-dev] debugging PipeableOSProcess

Jimmie Houchin j.squeak at cyberhaus.us
Thu Mar 6 05:30:31 UTC 2008


David T. Lewis wrote:
> 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,

Hello Dave,

Thanks for the help.

As per your other message, I had already tried alt-. to attempt to
interrupt the UI and enter a debugger, but the image does not respond.
It just stays locked. :)

I tried searching the image for how to use the other parts of the
PipeableOSProcess command, input: output: errorPipelineStream:, but
didn't find any. So I do not know how to do what you describe.

While writing this I went ahead and killed wget. Then Squeak interrupted
the UI and had a debugger. It had:

in UnixOSProcessAccesser>>grimReaperProcess

Any help on how to use the stdout and stderr pipes would be greatly
appreciated.

Thanks.

Jimmie



More information about the Squeak-dev mailing list