mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Fix incorrect error on read
with 1-character input
When `read` is given a single character of input (including the newline), it was bailing as if it had been given no input. This is incorrect.
This commit is contained in:
parent
a9c8b75599
commit
a012aedb31
3 changed files with 4 additions and 1 deletions
|
@ -2655,7 +2655,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (buff.size() < 2 && eof)
|
||||
if (buff.empty() && eof)
|
||||
{
|
||||
exit_res = 1;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ echo 'test' | read -l one two three
|
|||
print_vars one two three
|
||||
echo 'foo bar baz' | read -l one two three
|
||||
print_vars one two three
|
||||
echo -n 'a' | read -l one
|
||||
echo "$status $one"
|
||||
|
||||
echo
|
||||
set -l IFS
|
||||
|
|
|
@ -17,6 +17,7 @@ two
|
|||
1 '' 1 ''
|
||||
1 'test' 1 '' 1 ''
|
||||
1 'foo' 1 'bar' 1 ' baz'
|
||||
0 a
|
||||
|
||||
1 'hello'
|
||||
1 'h' 1 'ello'
|
||||
|
|
Loading…
Reference in a new issue