mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 21:43:55 +08:00
Fix bug where pressing ^C while in the read builtin would mess up the block execution bit
darcs-hash:20070131235810-ac50b-23dde9d0e13cc028b744307073c1daf989258b54.gz
This commit is contained in:
parent
3b653cd26a
commit
15e0a44fc7
16
reader.c
16
reader.c
|
@ -256,6 +256,12 @@ typedef struct reader_data
|
||||||
*/
|
*/
|
||||||
static reader_data_t *data=0;
|
static reader_data_t *data=0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
This flag is set to true when fish is interactively reading from
|
||||||
|
stdin. It changes how a ^C is handled by the fish interrupt
|
||||||
|
handler.
|
||||||
|
*/
|
||||||
|
static int is_interactive_read;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flag for ending non-interactive shell
|
Flag for ending non-interactive shell
|
||||||
|
@ -400,11 +406,17 @@ static void reader_kill( wchar_t *begin, int length, int mode, int new )
|
||||||
void reader_handle_int( int sig )
|
void reader_handle_int( int sig )
|
||||||
{
|
{
|
||||||
block_t *c = current_block;
|
block_t *c = current_block;
|
||||||
|
|
||||||
|
if( !is_interactive_read )
|
||||||
|
{
|
||||||
while( c )
|
while( c )
|
||||||
{
|
{
|
||||||
|
c->type=FAKE;
|
||||||
c->skip=1;
|
c->skip=1;
|
||||||
c=c->outer;
|
c=c->outer;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interrupted = 1;
|
interrupted = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2077,8 +2089,10 @@ wchar_t *reader_readline()
|
||||||
*/
|
*/
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
|
int was_interactive_read = is_interactive_read;
|
||||||
|
is_interactive_read = 1;
|
||||||
c=input_readch();
|
c=input_readch();
|
||||||
|
is_interactive_read = was_interactive_read;
|
||||||
|
|
||||||
if( ( (!wchar_private(c))) && (c>31) && (c != 127) )
|
if( ( (!wchar_private(c))) && (c>31) && (c != 127) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user