mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 14:24:35 +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);
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
parser->pop_block(ib);
|
||||
|
||||
|
|
|
@ -121,3 +121,12 @@ echo -e Catch your breath
|
|||
|
||||
echo -e 'abc\x21def'
|
||||
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
|
||||
abc!def
|
||||
abc!1def
|
||||
1
|
||||
|
|
Loading…
Reference in New Issue
Block a user