mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 14:43:55 +08:00
read: Don't use chunking read with --line
Fixes a regression from #8552.
This commit is contained in:
parent
dc5bdda8e0
commit
cd62771d12
|
@ -501,6 +501,10 @@ maybe_t<int> builtin_read(parser_t &parser, io_streams_t &streams, const wchar_t
|
|||
read_interactive(parser, buff, opts.nchars, opts.shell, opts.silent, opts.prompt,
|
||||
opts.right_prompt, opts.commandline, streams.stdin_fd);
|
||||
} else if (!opts.nchars && !stream_stdin_is_a_tty &&
|
||||
// "one_line" is implemented as reading n-times to a new line,
|
||||
// if we're chunking we could get multiple lines so we would have to advance
|
||||
// more than 1 per run through the loop. Let's skip that for now.
|
||||
!opts.one_line &&
|
||||
(streams.stdin_is_directly_redirected || lseek(streams.stdin_fd, 0, SEEK_CUR) != -1)) {
|
||||
// We read in chunks when we either can seek (so we put the bytes back),
|
||||
// or we have the bytes to ourselves (because it's directly redirected).
|
||||
|
|
|
@ -375,3 +375,10 @@ echo foo\nbar\nbaz | begin
|
|||
echo $bar
|
||||
# CHECK: bar
|
||||
end
|
||||
|
||||
begin
|
||||
echo 1
|
||||
echo 2
|
||||
end | read -l --line foo bar
|
||||
echo $foo $bar
|
||||
# CHECK: 1 2
|
||||
|
|
Loading…
Reference in New Issue
Block a user