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.