是否可以使用 return 代码手动退出 Smalltalk vm?

Is it possible to manually exit out of Smalltalk vm with return code?

基本上,GNU Smalltalk 3.2.5 中是否有某种类似于 exit(-1) 功能的东西?或者有没有办法配置它,以便如果它在执行过程中遇到错误,它会 return 非零退出代码?我希望能够检测 gst 是否成功执行了 st 代码文件,或者是否发生了错误(语法或 runtime/exception)。

是的,可以使用 ObjectMemory quit: 0ObjectMemory quit: 1 等。source code 用于 ObjectMemory quit:

ObjectMemory class >> quit: exitStatus [
    "Quit the Smalltalk environment, passing the exitStatus integer
     to the OS. Files are closed and other similar cleanups occur."

    <category: 'builtins'>
    <primitive: VMpr_ObjectMemory_quit>
    SystemExceptions.WrongClass signalOn: exitStatus mustBe: SmallInteger
    ]

在源代码中搜索 'quit' 将提供它的实际示例。