[squeak-dev] Running Squeak fro ma unix shell script file with #! squeak...

tim Rowledge tim at rowledge.org
Mon May 20 04:57:20 UTC 2019

> On 2019-05-13, at 7:11 PM, Chris Cunnington <brasspen at gmail.com> wrote:
> Pretty cool. If Tim gets this working to his satisfaction I hope he makes a post with an example. 

It nearly does it.

Right now you can (with a fully updated trunk image, specifically on Raspbian, maybe other linuxes, no way for me to test) make a .st file executable and add a line of the form 
#!/usr/bin/squeak /home/pi/Squeak/TPR-Squeak5.3-18560.image
as the first line. You can run this from a commandline with the usual ./MyAmazing.st

As an example
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WebFib.st
Type: application/octet-stream
Size: 3140 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190519/d3ba43e7/attachment.obj>
-------------- next part --------------

will open the specified image, install a fast fibonacci method (thanks Nicolas!), add a fibonacci server method to WebServer and fire up Webserver. This is seriously cool. Double-clicking the .st works too, thought in Raspbian you do have to say to execute it or execute it in a terminal (either works, by the way. No idea how to stop the make-a-choice dialogue).

Of  course, you can do the more manual
squeak myAmazing.image WebFib.st
as well

Note that this is all without making use of Dave's excellent shell stuff, something else to play with. And indeed the amazing suggestion about the /proc/sys/fs/binfmt_misc/register magic from Subbu.

The bit that I'd like to find a way to improve is having the ability to *not* open any windows. Right now the main window opens (as I've said many times, no window should open until some image code forces it to) and the UI is started up and the filing in etc happens after that. I don't know how we can nicely handle that; after all some legitimate uses of a script file would be to start a GUI application. Others would be of the 'calculate optimal firing solution and quit' variety.

Two apparent bugs also require some thought and probably solving by someone else
a) Windows appears to be unable to write to stdout - and probably therefore  unable to read from stdin - despite the code appearing to be in the VM sources.
b) Ubuntu (at least)  seems to have a problem with stdout etc not being initialised properly unless we reset the StartUpList order. Why Raspbian did not have that problem I can't imagine - they're both Debian based IIRC.

So all in all, damn cool stuff that could be made coolerer with some help.

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Bayard(n): a person armed with the self-confidence of ignorance

More information about the Squeak-dev mailing list