Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cluster-launch-installer-e2e: Wait on the create process ID
From the POSIX spec [1]: If the wait utility is invoked with no operands, it shall wait until all process IDs known to the invoking shell have terminated and exit with a zero exit status. If one or more pid operands are specified that represent known process IDs, the wait utility shall wait until all of them have terminated. If one or more pid operands are specified that represent unknown process IDs, wait shall treat them as if they were known process IDs that exited with exit status 127. The exit status returned by the wait utility shall be the exit status of the process requested by the last pid operand. Because the bare 'wait' from d862f6f (cluster-launch-installer-e2e: Restore EXIT and TERM signal handlers, 2018-10-17, openshift#1957) contained no PID arguments, it was returning zero even when the install command failed. Here's a simple example demonstrating the effect: $ false & $ wait $ echo $? 0 With this command, we use $! to get the installer's process PID [2], and pass that to 'wait'. Now the wait call will exit with the installer exit status, and because it's the last command in the shell script, the script will also exit with the installer exit status. Here's a simple example demonstrating the new approach: $ false & $ wait "$!" $ echo $? 1 [1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/wait.html [2]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02
- Loading branch information