On 20 January 2011 22:05, Chris Muller <asqueaker@gmail.com> wrote:
The Ma stack does something similar, although not crippling the system to the same extent.
well, if by 'crippling' you mean preventing any unwanted activity when headless.. then yes, i want it :)
How do you determine you're running headless? Â I attached my implementation of #maIsHeadless for determining whether the VM was launched headless. Â Perhaps we should integrate this functionality into Squeak and Pharo (or a variant without the prefix, of course).
okay, as i suspected there is no direct way to determine that.. i don't like checking the command-line args, because obviously i can build vm which completely ignores that. but since there is no other options...
Then, I use MaCommandLineProcessor which is concerned with handling the command-line Squeak was launched with:
Then, I write my .st scripts like:
[snip] ohh.. well, but that is too much for a simple script. it would be good if image could provide something by default, because i don't want to repeat expressions like this in each script i write for running it in headless image. :)
 - Chris
On Thu, Jan 20, 2011 at 2:39 PM, Igor Stasenko <siguctua@gmail.com> wrote:
Hello folks.
I'd like to ask, if there any 'standartized' instruments for headless images (or alike).
I need a simple things:  - redirect all  ToolSet/UIManager messages to Transcript  - redirect Transcript logging to file or stdout
in short, these tools should serve a simple, yet important purpose: Â - if image runs in headless mode, it should suppress anything which expecting user interaction (like showing warnings with 'continue' button) and either log such messages to file or simply quit image with error message.
Without such tool it is quite difficult to monitor, what happens with your headless image.. unless you have RFB installed.. but that is different and unrelated story.
I did a prototype once for Hydra (you can check it at SqS/HydraVM/HydraVM.mcz package) there are two subclasses: - MorphicUIManager subclass: #HydraUIManager - StandardToolSet subclass: #HydraDebugToolSet
and - WriteStream subclass: #HydraTranscript
which can be installed as a Transcript.
And in order to prepare image to run in headless mode, i issued: Â Â Â Â ToolSet unregister: StandardToolSet. Â Â Â Â ToolSet register: HydraDebugToolSet. Â Â Â Â UIManager default: HydraUIManager new.
Also, HydraTranscript startUp does something like:
    TranscriptStream         newTranscript: (self basicNew initialize                 on: (String new: 1000))
With that i could run the image in headless mode, knowing that in case of error or warning etc, all will be redirected to transcript, moreover i even stopped the UI process, so it never run on headless images.
I wonder if there are other work, which can offer similar, and is there any way to detect that image are running in headless mode?
-- Best regards, Igor Stasenko AKA sig.
-- Best regards, Igor Stasenko AKA sig.