[squeak-dev] CommandLineUIManager

Chris Muller asqueaker at gmail.com
Tue Nov 5 23:27:27 UTC 2019


Hi Christoph,

I don't know if you're actually looking for an interactive REPL, but if all
you need is to run a script...

> Exactly. If you run a simple script such as [HelpIcons squeakIcon
> writeOnFileNamed: 'testicon.png'] in headless mode and testicon.png already
> exists, the execution will be halted and the VM is waiting for a user
> interaction that will never happen. It would be much nicer to get a prompt
> via stdout + stdin to answer.
>
... then you only need to wrap your expression in a Smalltalk run: [ ... ]
block.  For example, if you wrap your expression and put it into some file,
say, "script.st",

              "contents of script.st"
              Smalltalk run: [HelpIcons squeakIcon writeOnFileNamed:
'testicon.png']

then, it'll be ready for headless, you can:

          squeak -vm display=none my.image script.st > my.out 2>&1

and it'll redirect all stdout and stderr to file "my.out".  All uncaught
exceptions (except Halt, I think) are handled and printed.

For servers, one thing I also put at the beginning my run block is:

       Smalltalk mitigateIfHeadless

which starts the RFB server, only if it's in headless mode, so I can get in
there if I need to.

HTH,
  Chris



>
> And even if the VM is run in a read-only shell, you would at least know
> *why* it does not continue to execute. For example, this would be helpful
> on smalltalkCI - if you had not caught all ProvideAnswerNotifications in
> your tests, you would basically have no hint why you get a timeout.
>
>
> I know Squeak is primarily made for use in a VM window, but nonetheless, I
> would love to have an implementation similar to this one for Pharo
> <https://github.com/StephanEggermont/pharo/blob/development/src/UIManager/CommandLineUIManager.class.st#L104>
> in Squeak.
>
>
> Best,
>
> Christoph
> ------------------------------
> *Von:* Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im
> Auftrag von tim Rowledge <tim at rowledge.org>
> *Gesendet:* Freitag, 1. November 2019 20:01:50
> *An:* The general-purpose Squeak developers list
> *Betreff:* Re: [squeak-dev] CommandLineUIManager
>
>
>
> > On 2019-11-01, at 11:29 AM, Thiede, Christoph <
> Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
> >
> > Hi all,
> >
> > does Squeak already support something like a CommandLineUIManager?
>
> We discussed some stuff around this topic back in May '19 relating to
> "Running Squeak fro ma unix shell script file with #! squeak..." (including
> the spilling mistook).
>
> And don't forget CommandShell (
> http://map.squeak.org/package/2c3b916b-75e2-455b-b25d-eba1bbc94b84),
> OSProcess (
> http://map.squeak.org/package/812c9d14-5236-4cad-82ea-cc3e3837e30d), and
> Eliot's simple exemplar REPL thing (
> https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/image/LoadReader.st
> &
> https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/image/StartReader.st
> )
>
> I also see that http://www.squeaksource.com/@azqxWT7-o5bjyYS2/vd0deS9q
> claims to include a REPL package (never tried it, see also
> http://gulik.pbworks.com/w/page/7760030/REPLServer)
>
> And I'm sure Craig has done something related but I simply cannot get
> google to find it right now
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>  Negligent (adj.), describes a condition in which you absentmindedly
> answer the door in your nightgown.
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191105/5c21567a/attachment.html>


More information about the Squeak-dev mailing list