1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

Test suite: Regression fix - wait_until should not run command in sub-shell.

Commit 25e82a8a667a54c6921ef076c63fdd738dd75d19 changed wait_until()
to protect the command it runs from "set -e" by running it in a
subshell.  This breaks uses where the command is expected to set
global variables.  For example, wait_until_get_src_socket lost the
value of $out from its call to get_src_socket().

The fix is to not be lazy and use a sub-shell!

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 39642e745254d93d74dde907787503854fe6ca4a)
This commit is contained in:
Martin Schwenke 2009-10-28 13:02:18 +11:00
parent 69cca03851
commit 8767c894a0

View File

@ -297,8 +297,8 @@ wait_until ()
echo -n "<${timeout}|"
local t=$timeout
while [ $t -gt 0 ] ; do
("$@")
local rc=$?
local rc=0
"$@" || rc=$?
if { ! $negate && [ $rc -eq 0 ] ; } || \
{ $negate && [ $rc -ne 0 ] ; } ; then
echo "|$(($timeout - $t))|"