Forget to say something, if I unload and reload the OSProcess package, then starts working well again.

El 19 de abril de 2012 09:27, Gast�n Dall' Oglio <gaston.dalloglio@gmail.com> escribi�:
Hi.

I use OSProcess in Windows (XP and Seven) and I notice that it hang when I open the image with OSProcess already loaded. I try in Seaside-3.0.7-OneClick and Pharo-1.4-14438-OneClick, and I get same error.

Step to reproduce:
1. Load OSProcess in a clean image. I use this snippet:
Gofer new
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfOSProcess';
load.
((Smalltalk at: #ConfigurationOfOSProcess) project version: #stable) load.

2. Save and quit.
3. Open same image,�with OSProcess already load.
4. Inspect this:
OSProcess command: 'dir'.

You can notice that process never is completed, however the operating system window where running is already closed. If you inspect previous code after step 1 (before save and quit) the process is completed.

In another hand, I notice that in the ConfigurationOfOSProcess>>baseline44 there is a OSProcess-Tests package, but this there isn't in the repo, and the tests classes are loaded with just load OSProcess package. I don't want load the tests in the deploy images. Maybe I do something wrong.

Regards.


El 18 de abril de 2012 21:07, David T. Lewis <lewis@mail.msen.com> escribi�:

On Wed, Apr 18, 2012 at 02:47:38PM -0700, Sean P. DeNigris wrote:
> Sometimes, OSProcess hangs even though the underlying command has completed.
>
> For example, on Mac 10.7.3:
> � � p := PipeableOSProcess waitForCommand: 'ps -ax -o pid,command' "never
> returns"
> � even though "p upToEnd" immediately returns the output if I use #command:
> instead of waiting.
>
> How best to handle this?
>
> Thanks.
> Sean

PipeableOSProcess class>>waitForCommand: is just a loop that waits for
the command (running in an external process) to complete. If the command
does not complete, it keeps looping.

The program that you are running (/bin/ps) will try to exit after it has
written all of its output to its standard output, which in this case is
a pipe connected back to your VM. But if the pipe fills up (the operating
system will put some limit on this), the /bin/ps program will block trying
to write to its output until somebody reads some of that data from the
pipe. If nobody reads the output, the /bin/ps program will just block
forever, and it will seem to be "stuck" and will never exit.

What to do? Read the data from the output of the PipeableOSProcess. The
/bin/ps program will then be unblocked, and it will finish writing its
output and then exit normally.

Dave