Skip to content

Commit 4a6b3c5

Browse files
JeffBezansonKristofferC
authored andcommitted
fix #31686, segfault on invalid cmdline option (#31689)
(cherry picked from commit 5ce94d8)
1 parent 414b46d commit 4a6b3c5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ static void jl_close_item_atexit(uv_handle_t *handle)
222222

223223
JL_DLLEXPORT void jl_atexit_hook(int exitcode)
224224
{
225+
if (jl_all_tls_states == NULL)
226+
return;
227+
225228
jl_ptls_t ptls = jl_get_ptls_states();
226229

227230
if (exitcode == 0)

test/cmdlineargs.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ let exename = `$(Base.julia_cmd()) --startup-file=no`
172172
# --procs
173173
@test readchomp(`$exename -q -p 2 -e "println(nworkers())"`) == "2"
174174
@test !success(`$exename -p 0`)
175-
@test !success(`$exename --procs=1.0`)
175+
let p = run(`$exename --procs=1.0`, wait=false)
176+
wait(p)
177+
@test p.exitcode == 1 && p.termsignal == 0
178+
end
176179

177180
# --machine-file
178181
# this does not check that machine file works,

0 commit comments

Comments
 (0)