mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Pause signal-masking during script parsing
Script parsing includes reading script content from stdin, which in turn includes interactive Zeek sessions. Keeping the signals masked there broke ctrl-c behavior.
This commit is contained in:
parent
5beb68194d
commit
9138d5c64e
1 changed files with 9 additions and 2 deletions
|
@ -606,8 +606,9 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
||||||
|
|
||||||
// Mask signals relevant for our signal handlers here. We unmask them
|
// Mask signals relevant for our signal handlers here. We unmask them
|
||||||
// again further down, when all components that launch threads have done
|
// again further down, when all components that launch threads have done
|
||||||
// so. The launched threads inherit the active signal mask and thus
|
// so, and intermittently during parsing. The launched threads inherit
|
||||||
// prevent our signal handlers from running in unintended threads.
|
// the active signal mask and thus prevent our signal handlers from
|
||||||
|
// running in unintended threads.
|
||||||
set_signal_mask(true);
|
set_signal_mask(true);
|
||||||
|
|
||||||
if ( options.supervisor_mode )
|
if ( options.supervisor_mode )
|
||||||
|
@ -778,9 +779,15 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
||||||
if ( options.event_trace_file )
|
if ( options.event_trace_file )
|
||||||
etm = make_unique<EventTraceMgr>(*options.event_trace_file);
|
etm = make_unique<EventTraceMgr>(*options.event_trace_file);
|
||||||
|
|
||||||
|
// Parsing involves reading input files, including any input
|
||||||
|
// interactively provided by the user at the console. Temporarily
|
||||||
|
// undo the signal mask to allow ctrl-c. Ideally we'd do this only
|
||||||
|
// when we actually end up reading interactively from stdin.
|
||||||
|
set_signal_mask(false);
|
||||||
run_state::is_parsing = true;
|
run_state::is_parsing = true;
|
||||||
yyparse();
|
yyparse();
|
||||||
run_state::is_parsing = false;
|
run_state::is_parsing = false;
|
||||||
|
set_signal_mask(true);
|
||||||
|
|
||||||
RecordVal::DoneParsing();
|
RecordVal::DoneParsing();
|
||||||
TableVal::DoneParsing();
|
TableVal::DoneParsing();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue