From f3d025bd75aa83625e8c7604bbbc6a4c46b3bf40 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Mon, 3 Jul 2017 16:58:14 -0700 Subject: [PATCH] always define `argv` for scripts Found when testing what breaks when dereferencing undefined vars is an errors (#4163). Fixes #4181 --- src/fish.cpp | 2 ++ tests/test.fish | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fish.cpp b/src/fish.cpp index 833b66980..260d6144f 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -434,6 +434,8 @@ int main(int argc, char **argv) { } env_set(L"argv", sb.c_str(), 0); + } else { + env_set(L"argv", NULL, 0); } const wcstring rel_filename = str2wcstring(file); diff --git a/tests/test.fish b/tests/test.fish index db2bb9455..c42e4a08e 100644 --- a/tests/test.fish +++ b/tests/test.fish @@ -24,8 +24,6 @@ end set TERM xterm set -e ITERM_PROFILE -set -q argv -or set argv source test_util.fish (status -f) $argv or exit