[Vm-dev] Cog: command-line on Macs

Igor Stasenko siguctua at gmail.com
Mon Jan 24 16:41:05 UTC 2011


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.


More information about the Vm-dev mailing list