From abeaac66328f83d8962d6a5a4b9ce8712edbbaa5 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 25 Sep 2015 14:17:53 -0700 Subject: Teach builtin_string to recognize redirections, not just pipes Allows cases like `string split \n < file.txt` to work. Fixes 2422 --- src/io.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/io.h') diff --git a/src/io.h b/src/io.h index 8d12f685..bb4c0621 100644 --- a/src/io.h +++ b/src/io.h @@ -288,8 +288,9 @@ struct io_streams_t // fd representing stdin. This is not closed by the destructor. int stdin_fd; - // Whether this is the first process in a pipeline - bool is_first_process_in_pipeline; + // Whether stdin is "directly redirected," meaning it is the recipient of a pipe (foo | cmd) or direct redirection (cmd < foo.txt) + // An "indirect redirection" would be e.g. begin ; cmd ; end < foo.txt + bool stdin_is_directly_redirected; // Indicates whether stdout and stderr are redirected (e.g. to a file or piped) bool out_is_redirected; @@ -298,7 +299,7 @@ struct io_streams_t // Actual IO redirections. This is only used by the source builtin. Unowned. const io_chain_t *io_chain; - io_streams_t() : stdin_fd(-1), is_first_process_in_pipeline(false), out_is_redirected(false), err_is_redirected(false), io_chain(NULL) + io_streams_t() : stdin_fd(-1), stdin_is_directly_redirected(false), out_is_redirected(false), err_is_redirected(false), io_chain(NULL) { } }; -- cgit v1.2.3