mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-27 20:25:12 +00:00
Don't hang if stdin is closed and we have no bindings
This commit is contained in:
parent
232ed91ec7
commit
ee8fd21d28
2 changed files with 26 additions and 19 deletions
43
input.cpp
43
input.cpp
|
@ -495,18 +495,18 @@ wint_t input_readch()
|
||||||
{
|
{
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
CHECK_BLOCK( R_NULL );
|
CHECK_BLOCK( R_NULL );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Clear the interrupted flag
|
Clear the interrupted flag
|
||||||
*/
|
*/
|
||||||
reader_interrupted();
|
reader_interrupted();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Search for sequence in mapping tables
|
Search for sequence in mapping tables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
const input_mapping_t *generic = 0;
|
const input_mapping_t *generic = 0;
|
||||||
|
@ -525,27 +525,34 @@ wint_t input_readch()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
No matching exact mapping, try to find generic mapping.
|
No matching exact mapping, try to find generic mapping.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( generic )
|
if( generic )
|
||||||
{
|
{
|
||||||
wchar_t arr[2]=
|
wchar_t arr[2]=
|
||||||
{
|
{
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
arr[0] = input_common_readch(0);
|
arr[0] = input_common_readch(0);
|
||||||
|
|
||||||
return input_exec_binding( *generic, arr );
|
return input_exec_binding( *generic, arr );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
No action to take on specified character, ignore it
|
No action to take on specified character, ignore it
|
||||||
and move to next one.
|
and move to next one.
|
||||||
*/
|
*/
|
||||||
input_common_readch( 0 ); }
|
wchar_t c = input_common_readch( 0 );
|
||||||
|
|
||||||
|
/* If it's closed, then just return */
|
||||||
|
if (c == R_EOF)
|
||||||
|
{
|
||||||
|
return WEOF;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void input_mapping_get_names( wcstring_list_t &lst )
|
void input_mapping_get_names( wcstring_list_t &lst )
|
||||||
|
|
|
@ -23,7 +23,7 @@ function __fish_print_help --description "Print help message for the specified f
|
||||||
set -l sed_cmd -e $cmd1 -e $cmd2 -e $cmd3
|
set -l sed_cmd -e $cmd1 -e $cmd2 -e $cmd3
|
||||||
|
|
||||||
# Render help output, save output into the variable 'help'
|
# Render help output, save output into the variable 'help'
|
||||||
set -l help (nroff -man $__fish_datadir/man/man1/$item.1)
|
set -l help (nroff -man "$__fish_datadir/man/man1/$item.1")
|
||||||
set -l lines (count $help)
|
set -l lines (count $help)
|
||||||
|
|
||||||
# Print an empty line first
|
# Print an empty line first
|
||||||
|
|
Loading…
Reference in a new issue