Script with (successful) "until" loop fails with exit code 1

#1

Running a script step @ 1.1.6 fails with exit code 1 after executing the “let a=$?” line, before executing the last line.

a=1
until [ $a -eq 0 ]; do
  timeout 300 bash -c "flutter pub get"
  let a=$?
done

flutter packages pub run build_runner build
0 Likes

#2

Never mind. I realized that “let” exits with a 1 if the following statement evaluates to 0. So I surrounded it by “set +e” and “set -e” to ignore the non-zero exit code of the command.

Hope this helps someone in the future.

0 Likes