<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font face="DejaVu Sans Mono">Hi David,<br>
      <br>
      thank you for your detailed mail. I was trying your procedure and
      I have a question.<br>
      <br>
      I wrote this into file '~/download/test.st'<br>
      ----------------<br>
      OSProcess thisOSProcess stdOut nextPutAll: 'Hello World'. <br>
      Smalltalk quitPrimitive.<br>
      ----------------<br>
    </font><br>
    Then tried to run the script with: <br>
    ----------------<br>
    $> cd [squeak bin directory]<br>
    $> ./squeak -vm-display-null ../Squeak5.2-18229-64bit.image
    ~/download/test.st<br>
    ==== OUTOUT ======================<br>
    pthread_setschedparam failed: Operation not permitted<br>
    This VM uses a separate heartbeat thread to update its internal
    clock<br>
    and handle events.  For best operation, this thread should run at a<br>
    higher priority, however the VM was unable to change the priority. 
    The<br>
    effect is that heavily loaded systems may experience some latency<br>
    issues.  If this occurs, please create the appropriate configuration<br>
    file in /etc/security/limits.d/ as shown below:<br>
    <br>
    cat <<END | sudo tee /etc/security/limits.d/squeak.conf<br>
    *      hard    rtprio  2<br>
    *      soft    rtprio  2<br>
    END<br>
    <br>
    and report to the squeak mailing list whether this improves
    behaviour.<br>
    <br>
    You will need to log out and log back in for the limits to take
    effect.<br>
    For more information please see<br>
<a class="moz-txt-link-freetext" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/r3732#linux">https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/r3732#linux</a><br>
    ===============================================<br>
    ----------------<br>
    <br>
    But I get nothing back except from info messages, the script does
    not end, it seems Squeak is ignoring the "quitPrimitive". <br>
    <br>
    What is the simplest test script you recommend to start with ? <br>
    <br>
    bye<br>
    Nicola<br>
    <br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 10/22/19 6:11 PM, David T. Lewis
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20191023011116.GA2895@shell.msen.com">
      <pre class="moz-quote-pre" wrap="">Hi Christoph,

On Tue, Oct 22, 2019 at 10:41:16PM +0000, Thiede, Christoph wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Hi,

this a question by a shell noob: How can I use Squeak in a unix shell to run a command such as:

./squeak foo.image bar.st

I would like to do this in my WSL shell (Windows Subsystem for Linux) as well as on Travis.

WSL says:

squeak: cannot execute binary file: Exec format error

</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
The command line that you gave ("./squeak foo.image bar.st") would be
appropriate on a Unix system (Linux, OS X, or whatever) if you have
a file called "squeak" in your current directory, and if that file
is an executable file such as a shell script or a compiled executable.

I am not familiar with WSL, but assuming that it is trying to behave
like a Unix shell, I would interpret the error message as follows:

- The shell tried to execute the file "./squeak", where the "./"
portion of the file path means "in the current directory", and "squeak"
is the name of the file to be executed.

- It found the file, and tried to open it. You did not see a "file
not found" error, so there actually must be a file called "squeak" in
your local directory, and the file has execute permissions, so all
good so far.

- The shell then tried to execute the "squeak" program. This means
that the shell saw that the file was marked executable, and it asked
the operating system to "exec" the file (on a Unix system, this will
fork the shell process and overlay the executable in the new process,
see <a class="moz-txt-link-freetext" href="http://man7.org/linux/man-pages/man3/exec.3.html">http://man7.org/linux/man-pages/man3/exec.3.html</a>).

- For some reason, the file could not be executed ("Exec format error").

This suggest to me that the WSL environment did not know how to
execute the "squeak" file. Maybe it was a compiled binary (such as
a compiled VM) that the WSL system did not recognize, or maybe WSL
was not smart enough to figure out how to evaluate a shell script,
I don't know.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
Travis (without explicit OS setting, so I'm assuming unix as well) says:

squeak: could not find any display driver
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Travis is probably running on a real Unix system (or Linux, which
is very similar). Whatever it is, you can safely bet that it does
not provide a graphical display system such as X11, because a CI
system such as Travis is intended to run things remotely on a
server with no graphical user interface. So most likely, you are
trying to run a VM with graphical display on an operating system
that does not provide display services.

A Squeak VM will normally try to find a graphical display driver
unless you explicitly tell it (with a command line option) not to
do so. If you just run Squeak on a server with no X11 (or similar)
installed, the VM will try to open a display module, and when it
fails, it will give you an error message:

    platforms/unix/vm/sqUnixMain.c:      fprintf(stderr, "squeak: could not find any display driver\n");

The solution for this problem is specific to the Unix VM (in other
words, don't try this on your Windows VM). You can run the VM without
using an active display by using the '-vm-display-null' command
line parameter. On a Unix system, run "squeak -help" to see the
available options.

Thus, if you had a command such as this for running Squeak:

        ./squeak foo.image bar.st

Then you can run it in "headless" mode like this:

        ./squeak -vm-display-null foo.image bar.st

The Unix Squeak VM has loadable VM modules for things like soound
and the display, so -vm-display-null tells the VM to load the null
display driver instead of the vm-display-X11 or vm-display-Quartz
modules.

HTH,
Dave


</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
To run a script in headless mode, I should not need any graphical output? How can I achieve this? I would greatly appreciate your help!


Best,

Christoph
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>