I am running image like that: /Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet /Users/sig/projects/pharo/generator.image zzz arg1 arg2 arg3 and here what i got: (0 to: 10) collect: [:i | Smalltalk getSystemAttribute: i ]) #('/Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet' '/Users/sig/projects/pharo/generator.image' 'zzz' 'arg1' 'arg2' 'arg3' nil nil nil nil nil) but: (0 to: 10) collect: [:i | Smalltalk getSystemAttribute: 0-i ] #('/Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet' 'arg1' 'arg2' 'arg3' nil nil nil nil nil nil nil) where is my pony named zzz? Here the description from getSystemAttribute: -1000...-1 - command line arguments that specify VM options 0 - the full path name for currently executing VM (or, on some platforms, just the path name of the VM's directory) 1 - full path name of this image 2 - a Pharo document to open, if any 3...1000 - command line arguments for Pharo programs so, i expected that it does mangling for attribute num > 0 , but for negative ones, i expected them to be returned as is.. instead there is something weird there. Especially when running headless.. Cog doing hard work with removing a VM options from my sight.. so image can't determine if i run headless or not, based on command line arguments.. Here the command line: /Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet -headless /Users/sig/projects/pharo/generator.image headless.st 1 2 3 here the script (headless.st): (FileStream forceNewFileNamed: 'test' ) nextPutAll: ((0 to: 10) collect: [:i | Smalltalk getSystemAttribute: i ]) asString ; cr;lf; nextPutAll: ((0 to: 10) collect: [:i | Smalltalk getSystemAttribute: 0-i ]) asString ; cr;lf; close. Smalltalk snapshot: false andQuit: true. and here the script's output (test) : cat test #('/Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet' '/Users/sig/projects/pharo/generator.image' 'headless.st' '1' '2' '3' nil nil nil nil nil) #('/Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet' '1' '2' '3' nil nil nil nil nil nil nil) P.S. Cocoa VM completely ignoring -headless switch. -- Best regards, Igor Stasenko AKA sig. |
Hi Igor, I fixed that in my last sources (cocoa cog), it was a small bug on sqSqueakMainApplication>>getAttribute:. Latest sources from gitoriuos should have it. Cheers, Esteban El 24/01/2011, a las 1:41p.m., Igor Stasenko escribió: > > I am running image like that: > > /Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet > /Users/sig/projects/pharo/generator.image zzz arg1 arg2 arg3 > > > and here what i got: > > > (0 to: 10) collect: [:i | > Smalltalk getSystemAttribute: i ]) > > > #('/Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet' > '/Users/sig/projects/pharo/generator.image' 'zzz' 'arg1' 'arg2' 'arg3' > nil nil nil nil nil) > > > but: > > (0 to: 10) collect: [:i | > Smalltalk getSystemAttribute: 0-i ] > > #('/Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet' 'arg1' 'arg2' > 'arg3' nil nil nil nil nil nil nil) > > where is my pony named zzz? > > > Here the description from getSystemAttribute: > > -1000...-1 - command line arguments that specify VM options > 0 - the full path name for currently executing VM > (or, on some platforms, just the path name of the VM's directory) > 1 - full path name of this image > 2 - a Pharo document to open, if any > 3...1000 - command line arguments for Pharo programs > > > so, i expected that it does mangling for attribute num > 0 , but for > negative ones, i expected them to be returned as is.. > instead there is something weird there. > > Especially when running headless.. Cog doing hard work with removing a > VM options from my sight.. so image can't determine if i run headless > or not, based on command line arguments.. > > Here the command line: > > /Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet -headless > /Users/sig/projects/pharo/generator.image headless.st 1 2 3 > > > here the script (headless.st): > > (FileStream forceNewFileNamed: 'test' ) > nextPutAll: > ((0 to: 10) collect: [:i | > Smalltalk getSystemAttribute: i ]) asString ; > cr;lf; > nextPutAll: > ((0 to: 10) collect: [:i | > Smalltalk getSystemAttribute: 0-i ]) asString ; > cr;lf; > > close. > > Smalltalk snapshot: false andQuit: true. > > > and here the script's output (test) : > > cat test > #('/Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet' > '/Users/sig/projects/pharo/generator.image' 'headless.st' '1' '2' '3' > nil nil nil nil nil) > #('/Users/sig/Downloads/Cog.app/Contents/MacOS/Croquet' '1' '2' '3' > nil nil nil nil nil nil nil) > > > P.S. Cocoa VM completely ignoring -headless switch. > > > -- > Best regards, > Igor Stasenko AKA sig. |
On 24 January 2011 17:48, Esteban Lorenzano <[hidden email]> wrote: > > Hi Igor, > I fixed that in my last sources (cocoa cog), it was a small bug on sqSqueakMainApplication>>getAttribute:. Latest sources from gitoriuos should have it. > my agenda currently is simple: - how to reliably detect if image runs headless or headfull. the script , which provided by Chris were something like following: isHeadless "Check if vm were run with headless parameter. Different VMs for different platform have different multiple way(s) to indicate that" -1000 to: -1 do: [ :n | (#('display=none' '-headless' '-vm-display-null') includes: (self getSystemAttribute: n)) ifTrue: [ ^ true ] ]. ^ false but now apparently, it not works consistently everywhere.. and i wonder what to do next :( -- Best regards, Igor Stasenko AKA sig. |
Free forum by Nabble | Edit this page |