<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Chris,</p>
<p><br>
</p>
<p>unfortunately, I cannot reproduce your command - in my shell, the VM only outputs that "<span style="font-size: 12pt;">pthread_setschedparam failed: Operation not permitted. </span><span style="font-size: 12pt;">This VM uses a separate heartbeat thread ..."
 warning and then hangs on, even if my script ends by calling Smalltalk quitPrimitive.</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">---</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">However, I made the example with #writePNGfileNamed: because if the file exists, it does not raise an Error or some other unhandled exception, but a FileExistsException which, by default, opens a UIManager. This happens just
 so often in Squeak that I would like to implement a CommandLIneUIManager for this case.</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">And of course, you might even combine this with the SqueakShell to avoid this inconsistent situation:</span></p>
<p><span style="font-size: 12pt;"><img size="287990" contenttype="image/png" id="img672111" style="max-width: 99.9%; user-select: none;" contextid="img501500" tabindex="0" src="cid:242b0e87-3937-4dd8-b85a-dc07e23fbb5c"><br>
</span></p>
<p><br>
</p>
<p>If I find some time, I will be happy to upload some proposal into the inbox :)</p>
<p><br>
</p>
<p>@Fabio: Yes, separately handling a ProvideAnswerNotification in the SCITestRunner sounds good. However, I would first focus on solving that problem for all CLI applications, but I will keep it in mind :)</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Chris Muller <asqueaker@gmail.com><br>
<b>Gesendet:</b> Mittwoch, 6. November 2019 00:27:27<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] CommandLineUIManager</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi Christoph,</div>
<div><br>
</div>
<div>I don't know if you're actually looking for an interactive REPL, but if all you need is to run a script...</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div id="m_5883749803210323684m_-9216229290145765267m_-8264277002231197698m_6746035779098277513gmail-m_-1046624259523574497x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p>Exactly. If you run a simple script such as [<span>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.</span></p>
</div>
</div>
</div>
</blockquote>
<div>... 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, "<a href="http://script.st" target="_blank">script.st</a>", <br>
</div>
<div><br>
</div>
<div>              "contents of <a href="http://script.st">script.st</a>"</div>
<div>              Smalltalk run: [HelpIcons squeakIcon writeOnFileNamed: 'testicon.png']<br>
</div>
<div><br>
</div>
<div>then, it'll be ready for headless, you can:</div>
<div><br>
</div>
<div>          squeak -vm display=none my.image <a href="http://script.st" target="_blank">
script.st</a> > my.out 2>&1</div>
<div><br>
</div>
<div>and it'll redirect all stdout and stderr to file "my.out".  All uncaught exceptions (except Halt, I think) are handled and printed.</div>
<div><br>
</div>
<div>For servers, one thing I also put at the beginning my run block is:</div>
<div><br>
</div>
<div>       Smalltalk mitigateIfHeadless</div>
<div><br>
</div>
<div>which starts the RFB server, only if it's in headless mode, so I can get in there if I need to.</div>
<div><br>
</div>
<div>HTH,</div>
<div>  Chris</div>
<div><br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div id="m_5883749803210323684m_-9216229290145765267m_-8264277002231197698m_6746035779098277513gmail-m_-1046624259523574497x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p><span><br>
</span></p>
<p>And even if the VM is run in a read-only shell, you would at least know <i>why</i> 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.</p>
<p><br>
</p>
<p>I know Squeak is primarily made for use in a VM window, but nonetheless, I would love to have an implementation similar to
<a href="https://github.com/StephanEggermont/pharo/blob/development/src/UIManager/CommandLineUIManager.class.st#L104" target="_blank">
this one for Pharo</a> in Squeak.</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<div id="m_5883749803210323684m_-9216229290145765267m_-8264277002231197698m_6746035779098277513gmail-m_-1046624259523574497x_Signature">
<div name="x_divtagdefaultwrapper">
<div><font color="#808080" size="2"></font></div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_5883749803210323684m_-9216229290145765267m_-8264277002231197698m_6746035779098277513gmail-m_-1046624259523574497x_divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von tim Rowledge <<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>><br>
<b>Gesendet:</b> Freitag, 1. November 2019 20:01:50<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] CommandLineUIManager</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div><br>
<br>
> On 2019-11-01, at 11:29 AM, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br>
> <br>
> Hi all,<br>
> <br>
> does Squeak already support something like a CommandLineUIManager?<br>
<br>
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).<br>
<br>
And don't forget CommandShell (<a href="http://map.squeak.org/package/2c3b916b-75e2-455b-b25d-eba1bbc94b84" target="_blank">http://map.squeak.org/package/2c3b916b-75e2-455b-b25d-eba1bbc94b84</a>), OSProcess (<a href="http://map.squeak.org/package/812c9d14-5236-4cad-82ea-cc3e3837e30d" target="_blank">http://map.squeak.org/package/812c9d14-5236-4cad-82ea-cc3e3837e30d</a>),
 and Eliot's simple exemplar REPL thing (<a></a><a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/image/LoadReader.st" target="_blank">https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/image/LoadReader.st</a> &
<a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/image/StartReader.st" target="_blank">
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/image/StartReader.st</a>)<br>
<br>
I also see that <a href="http://www.squeaksource.com/@azqxWT7-o5bjyYS2/vd0deS9q" target="_blank">
http://www.squeaksource.com/@azqxWT7-o5bjyYS2/vd0deS9q</a> claims to include a REPL package (never tried it, see also
<a href="http://gulik.pbworks.com/w/page/7760030/REPLServer" target="_blank">http://gulik.pbworks.com/w/page/7760030/REPLServer</a>)<br>
<br>
And I'm sure Craig has done something related but I simply cannot get google to find it right now<br>
<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>;
<a href="http://www.rowledge.org/tim" target="_blank">http://www.rowledge.org/tim</a><br>
 Negligent (adj.), describes a condition in which you absentmindedly answer the door in your nightgown.<br>
<br>
<br>
<br>
</div>
</span></font></div>
<br>
</blockquote>
</div>
</div>
</div>
</body>
</html>