mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
parent
3915faf382
commit
98297e5234
4 changed files with 12 additions and 0 deletions
1
exec.cpp
1
exec.cpp
|
@ -592,6 +592,7 @@ void exec_job(parser_t &parser, job_t *j)
|
|||
CHECK(j,);
|
||||
CHECK_BLOCK();
|
||||
|
||||
/* If fish was invoked with -n or --no-execute, then no_exec will be set and we do nothing. */
|
||||
if (no_exec)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -673,6 +673,12 @@ parse_execution_result_t parse_execution_context_t::run_while_statement(const pa
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* no_exec means that fish was invoked with -n or --no-execute. If set, we allow the loop to not-execute once so its contents can be checked, and then break */
|
||||
if (no_exec)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Done */
|
||||
|
|
|
@ -123,6 +123,10 @@ echo -e Catch your breath
|
|||
echo -e 'abc\x21def'
|
||||
echo -e 'abc\x211def'
|
||||
|
||||
# Make sure while loops don't run forever with no-exec (#1543)
|
||||
echo "Checking for infinite loops in no-execute"
|
||||
echo "while true; end" | ../fish --no-execute
|
||||
|
||||
function always_fails
|
||||
if true
|
||||
return 1
|
||||
|
|
|
@ -37,4 +37,5 @@ abc
|
|||
Catch your breath
|
||||
abc!def
|
||||
abc!1def
|
||||
Checking for infinite loops in no-execute
|
||||
1
|
||||
|
|
Loading…
Reference in a new issue