Bug#779608: Acknowledgement (xvfb: cleanup on signal exits as well)
Correction, it should be 'wait "$!"' not 'wait' - the latter has different semantics from what we want here.
X
On 03/03/15 09:31, Ximin Luo wrote:
> As a follow-up, this hunk is also required:
>
> ---- cut here ----
> --- /usr/bin/xvfb-run 2015-03-03 09:25:05.899998561 +0100
> +++ /usr/bin/xvfb-run 2015-03-03 02:19:40.543821712 +0100
> @@ -180,7 +180,7 @@
>
> # Start the command and save its exit status.
> set +e
> -DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
> +DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1 & wait
> RETVAL=$?
> set -e
>
> ---- cut here ----
>
> because (as per man bash(1)): "If bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes. When bash is waiting for an asynchronous command via the wait builtin, the reception of a signal for which a trap has been set will cause the wait builtin to return immediately with an exit status greater than 128, immediately after which the trap is executed."
>
> The behaviour is the same as above for dash, as can be verified by sending signals to the following test script:
>
> ---- cut here ----
> #!/bin/sh
> clean_up() {
> echo "got here"
> }
> trap clean_up EXIT INT TERM
> sleep 68 & wait
> ---- cut here ----
>
> X
>
--
GPG: 4096R/1318EFAC5FBBDBCE
git://github.com/infinity0/pubkeys.git
Reply to: