[squeak-dev] Cog stdio

David T. Lewis lewis at mail.msen.com
Fri Jan 7 17:05:43 UTC 2011


On Fri, Jan 07, 2011 at 11:39:02AM -0500, Chris Cunnington wrote:
> MicroSqueak comes with a StdioListener.cs file, which is for sending 
> messages using the command line and seeing a response on the command 
> line. I take it the result would look like:
> 
> squeak>
> squeak>
> squeak>
> squeak>
> 
> in Terminal.
> 
> But StdioListener.cs cannot work with a MicroSqueak's 3.8 related 
> virtual machine, as stdio is a property of Cog. So, if I put 
> StdioListener.cs into 4.1, then I theorize I could send some kind of 
> message on the command line.
> 
> StdioListener>>#run
> 
>     ...snip to last line...
>     [Smalltalk snapshot: false andQuit: true]
> 
> That's interesting. No sooner has the image started than it's shutting 
> down. It won't exist as a process in Darwin.
> 
> I suppose that I could send a message to my image/vm upon startup:
> 
> $ ./Croquet ~/Desktop/Squeak4.1\ Designer/Squeak4.1.image ???
> 
> But I can't imagine what I'd send it on the command line. Any 
> suggestions would be appreciated.
> 
> Chris

On unix based systems you can read and write to a file stream
opened on '/dev/tty'. No VM modifications or OSProcess support is
required for this. Be careful though, because the VM will block on
read from this stream, so if you do "strm next: 10" the VM will
block until you give it 10 characters on its standard input stream
(note that terminal drivers do buffering so you may need to give
it a CR before the VM sees anything).

Dave




More information about the Squeak-dev mailing list