[Newbies] PipableOSProcess#notifyError

David T. Lewis lewis at mail.msen.com
Sat Jan 1 16:20:48 UTC 2011


On Sat, Jan 01, 2011 at 07:05:14AM +0000, Aidan Gauland wrote:
> Hi,
> 
> Why does the following statement not appear to do anything?  (I
> expected an error window to pop up.)
> 
> (PipeableOSProcess command: 'false') notifyError.
> 
> Stepping through this with the debugger, I found that the
> ExternalUnixOSProcess's runState is #unknownRunState instead of
> #complete, the value it must be in order for #notifyError to do
> anything.
> 
> --Aidan

Hi Aidan,

I should answer this question in several parts. First, why are you getting
an "unknown run state"? I'm not sure of this, but it sounds like something
is not working right in the OSProcess command cleanup. There is a background
process that watches the external OS processes and updates their run state.
Sometimes this process can be terminated, especially if you are debugging
things, but it will be restarted the next time you start your image. So
I'm hoping this part of the problem will just go away; if not please let
us know what operating system (Mac, Linux ?) you are using and I'll try
to give a better answer.

Second, why does #notifyError not seem to work? This is a timing issue.
If you look at the #notifyError method, you'll see that it only creates
a notifier if the external process is complete. However, when you evaluate
"(PipeableOSProcess command: 'false') notifyError" you will be sending
#notifyError right away, before the external process has had a chance
to run and before Squeak has been notified about the change in run state
(it will go from #running to #complete after the operation system notifies
Squeak that the external process has exited). You can confirm this by
evaluating the following, which should produce a notifier window:

  | p |
  p := PipeableOSProcess command: 'false'.
  (Delay forSeconds: 1) wait.
  p notifyError.

Finally, what's up that that #notifyError method in the first place?
It's in a method category called "private" which means that other classes
should not be using it (i.e. the method is intended for private use by
PipeableOSProcess itself). But if you check for senders of #notifyError,
you will see that there are none. This is an error on the part of the
author of the class (that's me). It means that this is a left over junk
method that I should have removed from CommandShell, but apparently I
forgot to do so.

HTH,
Dave



More information about the Beginners mailing list