summaryrefslogtreecommitdiffstats
path: root/tests/include.rc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/include.rc')
-rw-r--r--tests/include.rc13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/include.rc b/tests/include.rc
index f5cab1f6640..90bcb8ec7b8 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -127,8 +127,17 @@ function _EXPECT_WITHIN()
local success=0
while [ `date +%s` -lt $endtime ]; do
- "$@" | tail -1 | egrep -q "^${e}\$"
- if [ $? -eq 0 ]; then
+ ("$@") | tail -1 | egrep -q "^${e}\$"
+
+ local pipestatus=(${PIPESTATUS[@]})
+
+ ## Check command success
+ if [ ${pipestatus[0]} -ne 0 ]; then
+ break;
+ fi
+
+ ## Check match success
+ if [ ${pipestatus[2]} -eq 0 ]; then
success=1;
break;
fi