On Sat, Jan 01, 2011 at 09:39:24PM +0000, Aidan Gauland wrote:
David T. Lewis <lewis <at> mail.msen.com> writes:
[snip]
| p | p := PipeableOSProcess command: 'false'. (Delay forSeconds: 1) wait. p notifyError.
[snip]
Thanks, Dave. This clears up a *lot*. And that code does raise a dialog. But, yes, I shouldn't be using private methods. I didn't notice what category #notifyError was in.
#succeeded tells me if the command returned non-zero, but how do I get the actual return code?
The PipeableOSProcess is a wrapper around an ExternalUnixOSProcess, where the ExternalUnixOSProcess represents the actual process (in this case a Unix process running the program /bin/false). The PipeableOSProcess adds the higher level features needed to connect pipes to the Unix process and make it interact with Squeak. So if you want the exit status of the /bin/false program, you can get at it like this:
| p | p := PipeableOSProcess command: 'false'. [p isComplete] whileFalse: [(Delay forMilliseconds: 10) wait]. p processProxy exitStatus ==> 256
Also, I see that CommandShell and OSProcess haven't been updated since 2008. Would you consider doing a cleanup of these packages?
I think you have an out of date version of OSProcess and CommandShell. I don't keep the web pages updated on the Swiki very often, but the actual OSProcess and CommandShell package are on SqueakSource at http://www.squeaksource.com/OSProcess and http://www.squeaksource.com/CommandShell. There have been dozens of updates since 2008, so you can load the latest versions with a Monticello browser. The two packages that you would load are OSProcess-dtl.58 and CommandShell-dtl.50.
i.e. Removing obsolete methods such as #notifyError, and making all tests green in the latest version of Squeak. CommandShellTestCase??testPipeline65 and CommandShellTestCase??testPipeline66 are red (errors). But that's still really good: 385 out of 387 passes.
On Linux with the standard VM, you should get 100% green on all tests, except possibly for occasional intermittent failures related to timing. If you still get failures after updating from SqueakSource, please let me know.
IOHandle http://wiki.squeak.org/squeak/uploads/996/IOHandleV1-2-dtl.sar, however, fails to load into the Squeak image Squeak4.2-10779-alpha. Could you please fix that, too, if you have the time?
I have not been keeping the IOHandle package up to date in recent years. This was basically a proof of concept for some ideas I had about restructuring some of the socket and file code in Squeak. I'm not planning on doing anything further with this in the near term.
Thanks, Aidan
You're welcome. Thanks for experimenting with this and for raising some good questions!
Dave