-
Notifications
You must be signed in to change notification settings - Fork 21
Global Variables
mikeplavsky edited this page May 11, 2012
·
2 revisions
Check these powerslim code:
scenario | wait for | cmd | |
eval | $wait_for_threshold=60 * 10 | ||
eval | $wait_for_timeout=0 | ||
eval | while (!(@cmd) -and ($wait_for_timeout -le $wait_for_threshold)) {Sleep 10; $wait_for_timeout += 10;} | ||
check | eval | $wait_for_timeout -le $wait_for_threshold | True |
If you expect the last expression to be False when @cmd is not done in 10 minutes, you are wrong.
When adding 10 to $wait_for_timeout you do it with local variable.
To fix this add $global prefix
eval | while (!(@cmd) -and ($global:wait_for_timeout -le $wait_for_threshold)) {Sleep 10; $global:wait_for_timeout += 10;} |