mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 20:47:44 +08:00
move work out of interrupt handler (which is safer as well)
This commit is contained in:
parent
eb1c00c56b
commit
55b3cf4627
15
reader.cpp
15
reader.cpp
|
@ -581,22 +581,10 @@ static void reader_kill(size_t begin_idx, size_t length, int mode, int newv)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Called from a signal handler, so make sure to check \c data exists.
|
||||
This is in fact racey as there is no guarantee that \c *data's members are
|
||||
written to memory before \c data is. But signal handling is currently racey
|
||||
anyway, so this should be fixed together with the rest of the signal
|
||||
handling infrastructure.
|
||||
*/
|
||||
static bool get_interruptible()
|
||||
{
|
||||
return data ? data->interruptible : false;
|
||||
}
|
||||
|
||||
/* This is called from a signal handler! */
|
||||
void reader_handle_int(int sig)
|
||||
{
|
||||
if (!is_interactive_read || get_interruptible())
|
||||
if (!is_interactive_read)
|
||||
{
|
||||
parser_t::skip_all_blocks();
|
||||
}
|
||||
|
@ -671,6 +659,7 @@ int reader_reading_interrupted()
|
|||
if (res && data && data->interruptible)
|
||||
{
|
||||
reader_exit(1, 0);
|
||||
parser_t::skip_all_blocks();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user