1
我收到SIGTERM(不SIGINT)事件後,下面的堆棧跟蹤的朱莉婭 - 0.4.7腳本:朱莉婭0.4.7:如何捕捉SIGTERM
signal (15): Terminate
write at /lib64/libpthread.so.0 (unknown line)
unknown function (ip: 0x2ade16a02893)
uv_write2 at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
jl_uv_write at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
uv_write at ./stream.jl:951
buffer_or_write at ./stream.jl:972
write at ./stream.jl:1011
print at ./char.jl:47
unknown function (ip: 0x2ade1e06d0a2)
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
print at strings/io.jl:18
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
jl_f_apply at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
println at strings/io.jl:25
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
anonymous at /path/to/home/test.jl:4
unknown function (ip: 0x2ade169c5b13)
unknown function (ip: 0x2ade169c672c)
jl_load at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
include at ./boot.jl:261
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:333
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
process_options at ./client.jl:284
_start at ./client.jl:378
unknown function (ip: 0x2ade1e05ae79)
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
unknown function (ip: 0x401c87)
unknown function (ip: 0x40186f)
__libc_start_main at /lib64/libc.so.6 (unknown line)
unknown function (ip: 0x4018b5)
所以,我怎麼捉呢?看起來像是在我的朱莉婭二進制文件中被破壞了,不是嗎?有沒有類似的方式來像SIGINT一樣捕獲SIGTERM?即:
ccall(:jl_exit_on_sigint, Void, (Cint,), 0)
try
...
catch ex
println("caught something")
if isa(ex, InterruptException)
println("it was an interrupt")
end
end
我正在使用Cent-OS 6.5。