Yes, it works! if i open image like that: ./results/NBCog.app/Contents/MacOS/NBCog ./image/generator.image ; echo $? and then do: Smalltalk quitPrimitive: 10 it prints: 10 On 25 November 2011 17:01, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
in the bug tracker please :)
On Nov 25, 2011, at 4:59 PM, Igor Stasenko wrote:
There is already support for that in platform-specific code. The function is sqInt ioExitWithErrorCode(int);
so, the only thing which we need is to change the #primitiveQuit
to see if there an extra argument to it, and then call that function instead of ioExit
looks like easy to do.
Btw, actually Cog VMs already doing that:
primitiveQuit
   self ioExitWithErrorCode: (argumentCount = 1 ifTrue: [objectMemory integerValueOf: self stackTop] ifFalse: [0])
so.. you need only 1 thing:
add one more method to Smalltalk:
quitPrimitive: exitCode    "Primitive. Exit to another operating system on the host machine, if one    exists. All state changes in the object space since the last snapshot are lost.    Essential. See Object documentation whatIsAPrimitive."
   <primitive: 113>    self primitiveFailed
so you can use it right now.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.