mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 10:31:14 -03:00
Signal handling cleanup and improved safety
Fixes issue where you couldn't control-C out of a loop (https://github.com/ridiculousfish/fishfish/issues/13) Also stops doing memory allocation in the signal handler (oops) https://github.com/ridiculousfish/fishfish/issues/27
This commit is contained in:
21
parser.cpp
21
parser.cpp
@@ -371,14 +371,35 @@ parser_t::parser_t(enum parser_type_t type, bool errors) :
|
||||
|
||||
}
|
||||
|
||||
/* A pointer to the principal parser (which is a static local) */
|
||||
static parser_t *s_principal_parser = NULL;
|
||||
|
||||
parser_t &parser_t::principal_parser(void)
|
||||
{
|
||||
ASSERT_IS_NOT_FORKED_CHILD();
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
static parser_t parser(PARSER_TYPE_GENERAL, true);
|
||||
if (! s_principal_parser)
|
||||
{
|
||||
s_principal_parser = &parser;
|
||||
}
|
||||
return parser;
|
||||
}
|
||||
|
||||
void parser_t::skip_all_blocks(void)
|
||||
{
|
||||
/* Tell all blocks to skip */
|
||||
if (s_principal_parser)
|
||||
{
|
||||
block_t *c = s_principal_parser->current_block;
|
||||
while( c )
|
||||
{
|
||||
c->skip = true;
|
||||
c = c->outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Return the current number of block nestings
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user