[squeak-dev] Windows, stdin, stdout

Eliot Miranda eliot.miranda at gmail.com
Sat Apr 7 14:39:11 UTC 2018


Hi Benoît,

> On Apr 6, 2018, at 5:38 PM, Benoit St-Jean via Squeak-dev <squeak-dev at lists.squeakfoundation.org> wrote:
> 
> Thanks for your help.
> 
> So far, I've had :
> 
> a) lots of "primitive failed", most of the time primitiveFileAtEnd (FilePlugin)
> b) An error/warning message in the console, "VirtualProtect(x,y,PAGE_EXECUTE_READWRITE): No error" and then nothing happens, not even a prompt!

Bizarre that there's an error message for No error.

> c) A "Manufactured file handle detected" error
> d) An emergency error handler
> e) An error saying "stdout is not open"
> f) the VM terminating abruptly
> g) The "Squeak Cog Spur Virtual Machine" unresponsive and totally frozen (not even able to interrupt it!)

This is to be expected.  The reader image is blocked in the read in the FilePlugin and so is not running and hence is uninterruptible.

I built the reader to test the thread ffi and to test the simulator.  Once we have a production threaded ffi then only the reader process's thread will be blocked in the read and the image will run and the GUI be responsive while the reader is blocked waiting for input. This worked in 2010 in prototype form.

> 
> I tried the original and some refactored (VERY simple snippets) examples I could find on the net using :
> 
> a) OSProcess
> b) FileStream
> c) StdioListener
> 
> I have tried all tips & tricks : 
> a) load the "application code" from a script
> b) doIt the code in a workspace and save the image
> c) doIt some code with code to save the image first so the rest of the doIt resumes at startup
> d) I tried so many things I don't remember it all!!
> 
> So far, nothing worked, not even was I once close !  Except for the example with StdioListener : it shows the prompt but does nothing with the input...
> 
> I'm using Squeak 5.1 32bit on Windows 10.

Are you using an up-to-date console vm?

> 
> My goal is to produce a headless application is a *simple* way.  It can be a script or some code I execute in a workspace.  Then save the image (or whatever step is required). 
> 
> When running the application, I don't want to have to specify a script to start it up from the console.  Also, I don't want to open another command window!  I want the app/image to run from the command window without any artifact/trick the same way any other Windows utility/app would work.  I also want the application to be interactive (it waits for input, does something with the input, then shows result and presents me with a prompt again).

Right.  This is definitely possible.  I've just tried 64-bit Mac OS X and things are broken, so it looks like we have a regression somewhere.

> 
> Once I get this to work, you can be sure I'll document it in detail !!!!
> 
> 
> 
> ----------------- 
> Benoît St-Jean 
> Yahoo! Messenger: bstjean 
> Twitter: @BenLeChialeux 
> Pinterest: benoitstjean 
> Instagram: Chef_Benito
> IRC: lamneth 
> Blogue: endormitoire.wordpress.com 
> "A standpoint is an intellectual horizon of radius zero".  (A. Einstein)
> 
> 
> On Friday, April 6, 2018, 5:42:27 p.m. EDT, tim Rowledge <tim at rowledge.org> wrote:
> 
> 
> 
> 
> > On 06-04-2018, at 11:10 AM, Alistair Grant <akgrant0710 at gmail.com> wrote:
> > 
> > Hi Benoit,
> > 
> > On 6 April 2018 at 12:16, Benoit St-Jean via Squeak-dev
> > <squeak-dev at lists.squeakfoundation.org> wrote:
> >> Is there any way I can start squeak from a command window, *headless*, and
> >> WITHOUT providing a script and have an interactive application^  Say, for
> >> instance, my application waits for input and answers back the square of the
> >> number I type in?
> >> 
> >> I've tried a gazillion examples I found and it just doesn't work at all...
> >> 
> >> I'm on Windows 10 if that helps.
> > 
> > https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/image/buildspurtrunkreaderimage.sh
> 
> Just for the record here for the future - this process 
> a) simply loads the CogTools-Listener (sub)package from the VMMaker repository - which is a very small bit of code we could very sensibly include in the default image
> b) uses a simple initial script to create an image that will start up at the beginning of an incantation that loops around the StdioListener. All you do is start up the image saved after loading the Listener tools with the StartReader.st - subsequent runs do not need that.
> 
> Unfortunately it doesn't seem to be working quite right on my Pi at the moment; I get a "squeak>" prompt but it doesn't seem to ever read any input. I know it works in principle because I've used it plenty of times in the past , but clearly I'm forgetting some important detail.
> 
> 
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> 
> Useful Latin Phrases:- Te audire no possum. Musa sapientum fixa est in aure. = I can't hear you. I have a banana in my ear.
> 
> 
> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180407/fe2afcae/attachment.html>


More information about the Squeak-dev mailing list