gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 08:25:31 24 4
gpt4 key购买 nike

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

最佳答案

是的,可以使用 ObjectMemory quit: 0ObjectMemory quit: 1source codeObjectMemory 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' 将提供它的实际示例。

关于smalltalk - 是否可以使用返回码手动退出 Smalltalk vm?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45625873/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com