From 71af1a95663cf616150c0422e8d2d0ddfaa56296 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Sun, 16 Jul 2017 21:43:00 -0700 Subject: [PATCH] don't die if `read` is invoked with no var names Partial fix for #4220 by restoring the old behavior if no var name was provided. But we still set an empty var if a var name was provided. --- src/builtin_read.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/builtin_read.cpp b/src/builtin_read.cpp index 75be680c6..895184d4c 100644 --- a/src/builtin_read.cpp +++ b/src/builtin_read.cpp @@ -398,7 +398,9 @@ int builtin_read(parser_t &parser, io_streams_t &streams, wchar_t **argv) { if (optind == argc || exit_res != STATUS_CMD_OK) { // Define the var without any data. We do this because when this happens we want the user to // be able to use the var but have it expand to nothing. - env_set(argv[optind], NULL, opts.place); + // + // TODO: For fish 3.0 we should mandate at least one var name. + if (argv[optind]) env_set(argv[optind], NULL, opts.place); return exit_res; }