diff --git a/src/exec.cpp b/src/exec.cpp index 7fae21c3d..26809c80c 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -1006,6 +1006,11 @@ bool exec_job(parser_t &parser, const shared_ptr &j, const io_chain_t &bl return false; } + // Apply foo=bar variable assignments + for (const auto &assignment : j->processes.front()->variable_assignments) { + parser.vars().set(assignment.variable_name, ENV_LOCAL | ENV_EXPORT, assignment.values); + } + internal_exec(parser.vars(), j.get(), block_io); // internal_exec only returns if it failed to set up redirections. // In case of an successful exec, this code is not reached. diff --git a/tests/checks/exec.fish b/tests/checks/exec.fish index ddaa203a6..ed7d8d5a2 100644 --- a/tests/checks/exec.fish +++ b/tests/checks/exec.fish @@ -1,4 +1,5 @@ -#RUN: %fish %s +#RUN: %fish -C 'set -l fish %fish' %s + exec cat