是否可以使用返回码手动退出Smalltalk vm?

时间:2017-08-11 02:07:47

标签: smalltalk gnu-smalltalk

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

1 个答案:

答案 0 :(得分:3)

是的,可以使用ObjectMemory quit: 0ObjectMemory quit: 1ObjectMemory quit: <{1}} {/ 1}}

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
    ]

搜索&#39;退出&#39;在源代码中将提供它的实例。

相关问题