diff options
author | Kevin Ballard <kevin@sb.org> | 2012-06-21 19:31:25 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-06-24 13:43:44 -0700 |
commit | adfd3c10985bffeebd43a710b3f00f836f66569b (patch) | |
tree | d6665172e56315890a709b01c91530b7493a9d8e /builtin.cpp | |
parent | f7d0c4b065cb6a282a5e3d164bdcc5fc4a7e8b8e (diff) |
Don't blow away $status in switch statements
Tweak the switch and case builtins to not blow away $status
inappropriately. Fixes issue #161.
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin.cpp b/builtin.cpp index 219363b3..becff932 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -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(); } |