David T. Lewis wrote:
If you want a Squeak server to talk to your 'C process' through OS
pipes, you can do this with class PipeableOSProcess. You need to load
the packages OSProcess and CommandShell from SqueakMap (PipeableOSProcess
is in the CommandShell package). If your 'C process' interacts with
the world through stdin and stdout streams, this would be a reasonable
thing to do. This only works on Unix/Linux, but it would be fine for
your Linux server.
David. I'm not sure this does what I want. I think it only deals with unnamed OS pipes and not named pipes. However, I think I can treat names pipes just like they were files except I need to do an fcntl or equiv to ensure non-blocking reads. Have you, or anybody else done this before?
Bob
*** Confidentiality Notice *** Proprietary/Confidential Information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply email.
On Mon, Oct 31, 2005 at 01:22:49PM -0000, Bob.Cowdery@CGI-Europe.com wrote:
David T. Lewis wrote:
If you want a Squeak server to talk to your 'C process' through OS pipes, you can do this with class PipeableOSProcess. You need to load the packages OSProcess and CommandShell from SqueakMap (PipeableOSProcess is in the CommandShell package). If your 'C process' interacts with the world through stdin and stdout streams, this would be a reasonable thing to do. This only works on Unix/Linux, but it would be fine for your Linux server.
David. I'm not sure this does what I want. I think it only deals with unnamed OS pipes and not named pipes. However, I think I can treat names pipes just like they were files except I need to do an fcntl or equiv to ensure non-blocking reads. Have you, or anybody else done this before?
Yes, that's correct. If you prefer to use named pipes, you should be able to treat them as regular files (no need for OSProcess or any other add-on packages). I have not personally tried this, but I know of no reason that it would not work.
Do be careful of blocking reads on pipes though. The Squeak VM runs in a single OS process, and a blocking read will hang the entire VM if you are not careful. Note that if this happens on Linux you can always go to the /proc/<squeakprocess>/fd/* files and pump data into the file descriptors to unconstipate the VM. Also, see the #primSQFileSetNonBlocking: method in OSProcess for a way to prevent blocking the VM. This should work with named pipes also.
Dave
squeak-dev@lists.squeakfoundation.org