Don't blow away $status in switch statements

Tweak the switch and case builtins to not blow away $status
inappropriately. Fixes issue #161.
This commit is contained in:
Kevin Ballard 2012-06-21 19:31:25 -07:00 committed by ridiculousfish
parent f7d0c4b065
commit adfd3c1098

View file

@ -3540,6 +3540,7 @@ static int builtin_switch( parser_t &parser, wchar_t **argv )
parser.current_block->state1<wcstring>() = argv[1];
parser.current_block->skip=1;
parser.current_block->state2<int>() = 0;
res = proc_get_last_status();
}
return res;
@ -3568,7 +3569,7 @@ static int builtin_case( parser_t &parser, wchar_t **argv )
if( parser.current_block->state2<int>() )
{
return STATUS_BUILTIN_OK;
return proc_get_last_status();
}
for( i=1; i<argc; i++ )
@ -3588,7 +3589,7 @@ static int builtin_case( parser_t &parser, wchar_t **argv )
}
}
return STATUS_BUILTIN_OK;
return proc_get_last_status();
}