@@ -177,35 +177,20 @@ jdkw_wrapper="jdk-wrapper.sh"
177177download_if_needed " ${jdkw_impl} " " ${jdkw_path} "
178178download_if_needed " ${jdkw_wrapper} " " ${jdkw_path} "
179179
180- # Execute the provided command
181-
182- # Run the command in the backround (with all the trouble that entails)
183- # NOTE: Alternatively convert this to an exec if we don't need to output the
184- # wrapper mismatch at the end; e.g. make that a hard precondition to running.
185- set -m
186- trap ' kill -TERM ${impl_pid}' TERM INT
187- " ${jdkw_path} /${jdkw_impl} " " $@ " &
188- impl_pid=$!
189- fg
190- wait ${impl_pid} > /dev/null 2>&1
191- wait_result=$?
192- if [ ${wait_result} -ne 127 ]; then
193- result=${wait_result}
194- fi
195- trap - TERM INT
196- wait ${impl_pid} > /dev/null 2>&1
197- wait_result=$?
198- if [ ${wait_result} -ne 127 ]; then
199- result=${wait_result}
200- fi
201-
202180# Check whether this wrapper is the one specified for this version
203181jdkw_download=" ${jdkw_path} /${jdkw_wrapper} "
204182jdkw_current=" $( CDPATH= cd -- " $( dirname -- " $0 " ) " && pwd) /$( basename " $0 " ) "
205183if [ " $( checksum " ${jdkw_download} " ) " != " $( checksum " ${jdkw_current} " ) " ]; then
206184 printf " \e[0;31m[WARNING]\e[0m Your jdk-wrapper.sh file does not match the one in your JDKW_RELEASE.\n"
207185 printf " \e[0;32mUpdate your jdk-wrapper.sh to match by running:\e[0m\n"
208186 printf " cp \" %s\" \" %s\" \n" " ${jdkw_download} " " ${jdkw_current} "
187+ sleep 3
209188fi
210189
211- exit ${result}
190+ # Execute the provided command
191+ # NOTE: The requirements proved quite difficult to run this without exec.
192+ # 1) Exit with the exit status of the child process
193+ # 2) Allow running the wrapper in the background and terminating the child process
194+ # 3) Allow the child process to read from standard input when not running in the background
195+ exec " ${jdkw_path} /${jdkw_impl} " " $@ "
196+
0 commit comments