[squeak-dev] reading and writing from STDIN and STDOUT

Jason Rogers jacaetevha at gmail.com
Fri May 15 16:10:59 UTC 2009


Yes, doing that already.  The real problem was that the Python server
was expecting a line feed, and so was continuing to wait on the
stream's contents, and thus didn't move on with its execution stack.

Thanks for your help!!

On Fri, May 15, 2009 at 7:29 AM, David T. Lewis <lewis at mail.msen.com> wrote:
> On Fri, May 15, 2009 at 01:31:57AM -0400, Jason Rogers wrote:
>> On Tue, May 12, 2009 at 8:59 PM, David T. Lewis <lewis at mail.msen.com> wrote:
>> >
>> > ExternalCommandShell does this all in an event-driven manner with
>> > no polling, so you can copy that if you want to get fancy. Otherwise
>> > a simple polling loop in your process will probably work well enough.
>> > Put a 100 ms delay in whatever loop is reading from stdIn an you will
>> > get tolerable performance.
>> >
>> > Dave
>>
>> Thanks again Dave for the help.  My tack was to "copy"
>> ExternalCommandShell's pattern.  StdIn is working fine, but when I
>> write to StdOut nothing seems to actually "get out".  Any ideas?
>
> Try doing a #flush after you write to stdOut, like this:
>
>  OSProcess thisOSProcess stdOut
>     nextPutAll: 'hello world';
>     nextPut: Character lf;
>     flush.
>
> On unix (OS X), the I/O is done through the C stdio library. There is
> normally some buffering going on at that level, so if you flush the
> stream it should push the bytes out the tube.
>
>> I'm running on Mac, I don't have the AioPlugin installed (I've
>> commented out the inform: that tells about the plugin not being there
>> and therefore polling will be used).  I'm not verbose enough at
>> building plugins.
>
> Don't worry about it.  AioPlugin is used by CommandShell to do the
> event-driven I/O. If the plugin is not present, it gives you a warning
> and falls back on polling loops instead of using the "data ready"
> events from AioPlugin. For your application, polling loops should
> be good enough.
>
> Dave
>
>
>



-- 
Jason Rogers

"I am crucified with Christ: nevertheless I live;
yet not I, but Christ liveth in me: and the life
which I now live in the flesh I live by the faith of
the Son of God, who loved me, and gave
himself for me."
    Galatians 2:20



More information about the Squeak-dev mailing list