Fix a race detected only if a test times out (#3808)

* Fix a race detected only if a test times out

I believe this can happen because the goroutine is started before the
command is started. Start the process first, then on success, start the
signal handler. Add a test for regression.

I verified the test fails without my change to wrap.go and the race is
from the signal handling goroutine.

* Register signal handler before cmd.Start()
2 files changed