Tests and fix to allow return to work correctly within if statements. Closes #1297.

This commit is contained in:
ridiculousfish 2014-02-12 01:39:06 -08:00
parent dd49399e45
commit 29ddb68da4
3 changed files with 16 additions and 0 deletions

View File

@ -325,6 +325,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);

View File

@ -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

View File

@ -36,3 +36,4 @@ abc
Catch your breath
abc!def
abc!1def
1