Re: [PATCH] t9300-fast-import: don't hang if background fast-import exits too early

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SZEDER Gábor <szeder.dev@xxxxxxxxx> writes:

> +	(
> +		git fast-import $options <&8 >&9 &
> +		echo $! >V.fi.pid
> +		wait $!
> +		echo >&2 "background fast-import terminated too early with exit code $?"
> +		# Un-block the read loop in the main shell process.
> +		echo >&9 UNEXPECTED
> +	) &
> +	echo $! >V.sh.pid
>  	# We don't mind if fast-import has already died by the time the test
>  	# ends.
> -	test_when_finished "
> +	test_when_finished '
>  		exec 8>&-; exec 9>&-;
> -		kill $(cat V.pid) && wait $(cat V.pid)
> -		true"
> +		kill $(cat V.sh.pid) && wait $(cat V.sh.pid)
> +		kill $(cat V.fi.pid) && wait $(cat V.sh.pid)
> +		true'

The original interpolates the PID of the fast-import when
"when-finished" program is registered, so it is OK if somebody else
removed V.pid file; the new one interpolates when "when-finished"
program is run, reading from V.??.pid, so somebody needs to make
sure these pid files will stay around.  I do not think it is an
issue as I suspect we've left it to the global clean-up procedure
that removes the trash directory to remove the pid file.

By the way, does the second "kill && wait" wait for the right
process?

>  background_import_still_running () {
> -	if ! kill -0 "$(cat V.pid)"
> +	if ! kill -0 "$(cat V.fi.pid)"
>  	then
>  		echo >&2 "background fast-import terminated too early"
>  		false
>  	fi
>  }




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux