mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
hush: fix "while false; ..." exitcode; add testsuites
This commit is contained in:
parent
6a2d40f239
commit
918a34b9e0
@ -2305,8 +2305,10 @@ static int run_list(struct pipe *pi)
|
||||
#endif
|
||||
#if ENABLE_HUSH_LOOPS
|
||||
if (rword == RES_WHILE) {
|
||||
if (rcode)
|
||||
if (rcode) {
|
||||
rcode = 0; /* "while false; do...done" - exitcode 0 */
|
||||
goto check_jobs_and_break;
|
||||
}
|
||||
}
|
||||
if (rword == RES_UNTIL) {
|
||||
if (!rcode) {
|
||||
|
6
shell/hush_test/hush-misc/break4.right
Normal file
6
shell/hush_test/hush-misc/break4.right
Normal file
@ -0,0 +1,6 @@
|
||||
A
|
||||
AA
|
||||
TRUE
|
||||
A
|
||||
AA
|
||||
OK:0
|
12
shell/hush_test/hush-misc/break4.tests
Executable file
12
shell/hush_test/hush-misc/break4.tests
Executable file
@ -0,0 +1,12 @@
|
||||
cond=true
|
||||
while $cond; do
|
||||
echo A
|
||||
if test "$cond" = true; then
|
||||
cond='echo TRUE'
|
||||
else
|
||||
cond=false
|
||||
fi
|
||||
while true; do echo AA; continue 2; echo BB; done
|
||||
echo B
|
||||
done
|
||||
echo OK:$?
|
1
shell/hush_test/hush-misc/while1.right
Normal file
1
shell/hush_test/hush-misc/while1.right
Normal file
@ -0,0 +1 @@
|
||||
OK:0
|
2
shell/hush_test/hush-misc/while1.tests
Executable file
2
shell/hush_test/hush-misc/while1.tests
Executable file
@ -0,0 +1,2 @@
|
||||
while false; do echo NOT SHOWN; done
|
||||
echo OK:$?
|
Loading…
Reference in New Issue
Block a user