mirror of
https://github.com/janet-lang/janet
synced 2024-11-05 00:06:16 +00:00
Merge pull request #349 from sogaiu/tweak-unknown-signal-handling
Tweak unknown signal handling
This commit is contained in:
commit
16fe0a301c
@ -500,11 +500,16 @@ static Janet janet_core_signal(int32_t argc, Janet *argv) {
|
|||||||
sig = JANET_SIGNAL_USER0 + s;
|
sig = JANET_SIGNAL_USER0 + s;
|
||||||
} else {
|
} else {
|
||||||
JanetKeyword kw = janet_getkeyword(argv, 0);
|
JanetKeyword kw = janet_getkeyword(argv, 0);
|
||||||
if (!janet_cstrcmp(kw, "yield")) sig = JANET_SIGNAL_YIELD;
|
if (!janet_cstrcmp(kw, "yield")) {
|
||||||
if (!janet_cstrcmp(kw, "error")) sig = JANET_SIGNAL_ERROR;
|
sig = JANET_SIGNAL_YIELD;
|
||||||
if (!janet_cstrcmp(kw, "debug")) sig = JANET_SIGNAL_DEBUG;
|
} else if (!janet_cstrcmp(kw, "error")) {
|
||||||
|
sig = JANET_SIGNAL_ERROR;
|
||||||
|
} else if (!janet_cstrcmp(kw, "debug")) {
|
||||||
|
sig = JANET_SIGNAL_DEBUG;
|
||||||
|
} else {
|
||||||
janet_panicf("unknown signal, expected :yield, :error, or :debug, got %v", argv[0]);
|
janet_panicf("unknown signal, expected :yield, :error, or :debug, got %v", argv[0]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Janet payload = argc == 2 ? argv[1] : janet_wrap_nil();
|
Janet payload = argc == 2 ? argv[1] : janet_wrap_nil();
|
||||||
janet_signalv(sig, payload);
|
janet_signalv(sig, payload);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user