Hi Dave,
thank you for the detailed answer!
Actually, WSL is emulating a real unix system and it uses bash, so things like `cowsay Hello world` work indeed.
Is it possible that squeak does not support unix in general, but only certain distributions? It would be very nice to use it from WSL, which is becoming more important on Windows compared to the classic cmd.exe.
Regarding Travis: I found a few scripts such as https://github.com/hpi-swa/vivide/blob/master/scripts/prepare_image.sh#L64 that are calling Smalltalk as well. Why does that work, I would not assume that each Travis execution environment comes with a display driver, does it?
@Nicola Maybe you will want to have a look at CommandLineToolSet?
Best,
Christoph
________________________________ Von: Beginners beginners-bounces@lists.squeakfoundation.org im Auftrag von David T. Lewis lewis@mail.msen.com Gesendet: Mittwoch, 23. Oktober 2019 03:11:16 An: A friendly place to get answers to even the most basic questions about Squeak. Betreff: Re: [Newbies] Running Squeak in a Unix shell
Hi Christoph,
On Tue, Oct 22, 2019 at 10:41:16PM +0000, Thiede, Christoph wrote:
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
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 http://man7.org/linux/man-pages/man3/exec.3.html).
- 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.
Travis (without explicit OS setting, so I'm assuming unix as well) says:
squeak: could not find any display driver
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
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
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners