mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 05:42:49 +08:00
source: Actually check if stdin is a tty, not just redirected
This broke fishtape, which did somestuff | fish -c "source" Because `source` didn't have a redirection, it refused to read from stdin. So, to keep the common issue of `source (command that does not print)` from seeminly stopping fish, we instead actually check if stdin is a terminal.
This commit is contained in:
parent
9e7034c903
commit
a1c481c06a
|
@ -41,7 +41,7 @@ int builtin_source(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
|
||||
if (argc == optind || wcscmp(argv[optind], L"-") == 0) {
|
||||
// Either a bare `source` which means to implicitly read from stdin or an explicit `-`.
|
||||
if (argc == optind && !streams.stdin_is_directly_redirected) {
|
||||
if (argc == optind && isatty(streams.stdin_fd)) {
|
||||
// Don't implicitly read from the terminal.
|
||||
return STATUS_CMD_ERROR;
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ echo 'echo "source argv {$argv}"' | source -
|
|||
echo 'echo "source argv {$argv}"' | source - abc
|
||||
echo 'echo "source argv {$argv}"' | source - abc def
|
||||
# This hangs if it fails!
|
||||
source
|
||||
source </dev/tty
|
||||
echo $status
|
||||
|
||||
always_fails
|
||||
|
|
Loading…
Reference in New Issue
Block a user