mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-02 16:04:05 +08:00
Tests and fix to allow return to work correctly within if statements. Closes #1297.
This commit is contained in:
parent
dd49399e45
commit
29ddb68da4
|
@ -326,6 +326,12 @@ parse_execution_result_t parse_execution_context_t::run_if_statement(const parse
|
||||||
run_job_list(*job_list_to_execute, ib);
|
run_job_list(*job_list_to_execute, ib);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* It's possible there's a last-minute cancellation, in which case we should not stomp the exit status (#1297) */
|
||||||
|
if (should_cancel_execution(ib))
|
||||||
|
{
|
||||||
|
result = parse_execution_cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
parser->pop_block(ib);
|
parser->pop_block(ib);
|
||||||
|
|
||||||
|
|
|
@ -121,3 +121,12 @@ echo -e Catch your breath
|
||||||
|
|
||||||
echo -e 'abc\x21def'
|
echo -e 'abc\x21def'
|
||||||
echo -e 'abc\x211def'
|
echo -e 'abc\x211def'
|
||||||
|
|
||||||
|
function always_fails
|
||||||
|
if true
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
always_fails ; echo $status
|
||||||
|
|
||||||
|
|
|
@ -36,3 +36,4 @@ abc
|
||||||
Catch your breath
|
Catch your breath
|
||||||
abc!def
|
abc!def
|
||||||
abc!1def
|
abc!1def
|
||||||
|
1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user