OpenSmalltalk / opensmalltalk-vm

Cross-platform virtual machine for Squeak, Pharo, Cuis, and Newspeak.
http://opensmalltalk.org/
Other
547 stars 110 forks source link

Boot parameter -headless ignored in Windows 10 #639

Closed nmingotti closed 2 years ago

nmingotti commented 2 years ago

Hi, I am trying to deploy CuisSmalltalk as a scripting language in Windows 10. I am running the latest release of the VM Win32 built on Jun 2 2022 15:29:46 Compiler: Clang 14.0.3 [Production Spur 64-bit X64 VM]. I got almost all working but I found this little roadblock. As far as I can say the "-headless" parameter is ignored in Windows 10. ---- demo, headless is ignored.

win cmd> C:\CUIS\squeak.cog.spur_win64x64\SqueakConsole.exe -headless C:\CUIS\Cuis6.0-5031.image 
                                -d "StdIOWriteStream stdout nextPutAll: 'hello world'; newline." 
                                -d "Smalltalk quit."

=> hello world   [ headless is not working, if you remove the 'Smalltalk quit' you will see the window is well alive].

By comparison the parameter "-vm-display-null" works very well in Linux. ---- demo, fully working

$> ./sqcogspur64linuxht/squeak -vm-display-null Cuis-Smalltalk-Dev/Cuis6.0-5031.image 
           -d "StdIOWriteStream stdout nextPutAll: 'Hello World'; newLine" 
           -d 'Smalltalk quit.' 

=> Hello World     [and goodbye]

bye Nicola

marceltaeumel commented 2 years ago

Hmm... originally, that "headless" mode under Windows only tried to hide the window in the tray bar. Recent Windows versions seem to be persistent in re-raising that window once it gets hidden. How annoying. In any case, there has never been an actual "headless mode" for Windows.

nmingotti commented 2 years ago

Aaaah, pity ! If anybody knows Windows well enough to implement it this would be a very useful feature to have in the VM. I think Cuis, Squeak and Pharo (i speak for the 3 i tried) can do well in scripting. And they are easier to manage than Python for this reason: 1 dirctory with the VM, 1 image, 1 bat file and voilà your script is transported and independent from the rest of the system configuration. This is an exceptionally good thing for a system manager. Porability+Independence. Worth considering... ok, so, for the moment I can try with some ugly hack, like saving the image in a minimized state, or something like that. bye

OpenSmalltalk-Bot commented 2 years ago

It used to be that you had to have a window in order to get events in order for the event loop to be able to function etcetc. But didn't 'Windows service'(or sometihng like that?) VM get made some years ago?

On 2022-06-13, at 9:05 AM, Marcel Taeumel @.***> wrote:

Hmm... originally, that "headless" mode under Windows only tried to hide the window in the tray bar. Recent Windows versions seem to be persistent in re-raising that window once it gets hidden. How annoying. In any case, there has never been an actual "headless mode" for Windows.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

tim

tim Rowledge; @.***; http://www.rowledge.org/tim "Bother," said Pooh. "Eeyore - ready two photon torpedoes and lock phasers on the Heffalump. Piglet, meet me in Transporter Room Three."

nmingotti commented 2 years ago

I have seen the "service" option is some other posts around. But, as the name implies, services stay up for a long time. What I was running in this case is a single shot script. It runs quite fast, a few times per day. But should not be visible to the user, that is undesirable. bye

OpenSmalltalk-Bot commented 2 years ago

On 2022-06-13, at 10:22 AM, Dr. Nicola Mingotti @.***> wrote:

I have seen the "service" option is some other posts around. But, as the name implies, services stay up for a long time. What I was running in this case is a single shot script. It runs quite fast, a few times per day. But should not be visible to the user, that is undesirable. bye

Ah, I see. Maybe it might work to have the service stuff running and make it able to run the scripts you are thinking of? That would have some small advantage in no startup time being required.

tim

tim Rowledge; @.***; http://www.rowledge.org/tim A bar was walked into by the passive voice.

nmingotti commented 2 years ago

Hi Tim, umm, nope, it would be a big twist. What happens is this, there an analysis machine which has Windows IoT OS. When the builtin software finishes an analysis phase there is the option to run an executable of your choice. Here I run my stuff. Consider the analysis phase is long, takes at least 20 seconds, so nobody will notice if my script runs in 0.5 sec.

OpenSmalltalk-Bot commented 2 years ago

Oh dear, that's a pity. I don't do Windows so I'm out of ideas on the problem. :-( I see the 'Windows IoT OS' point - can we even run Squeak on that?

The headless thing works really well on linux for little scripts like "find the first fibonacci number with a million digits", which as we all know is something we do every day at least :-)

On 2022-06-13, at 1:44 PM, Dr. Nicola Mingotti @.***> wrote:

Hi Tim, umm, nope, it would be a big twist. What happens is this, there an analysis machine which has Windows IoT OS. When the builtin software finishes an analysis phase there is the option to run an executable of your choice. Here I run my stuff. Consider the analysis phase is long, takes at least 20 seconds, so nobody will notice if my script runs in 0.5 sec.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

tim

tim Rowledge; @.***; http://www.rowledge.org/tim C for sinking, java for drinking, Smalltalk for thinking

nmingotti commented 2 years ago

Just checked, the VM works in Windows 10 IoT, no problem on that. For the moment i leave the problem open, i don't know how to fix this. I guess a light change to SqueakConsole.exe might do the trick, but i can't pick that up now, too far into the realm of things i never did ;) If i find an hack to close the issue i will report. bye

nmingotti commented 2 years ago

I found the hack to circumvent the problem. Uses Powershell. This is the starting point.

ps>  Start-Process .\squeak.cog.spur_win64x64\Squeak.exe -ArgumentList .\borghiSerialExpoter.image -WindowStyle Minimized

I close the issue, still if anybody is able to fix -headless, well that would be better;) bye.