os: os.StartProcess test grandchild inconsistent behavior #37745
Comments
@davidmanzanares thanks for filing! @ianlancetaylor may know more. I think testing and os.StartProcess is a bit of a red herring here. This also happens if you use
Changing test.sh to the following: sleep 0.5
echo "hi"
sleep 5
echo "bye" ... will only print out "hi" in the test. This leads me to believe that things are behaving as intended. My guess is that the kill signal is sent while the command is in a blocking syscall (sleep), and the signal isn't handled until afterwards. I am not an expert though. |
When using Once those facts are taken into consideration, this is a dup of #23019. Closing as a dup. |
You're welcome! Thank you! It's nice to know why/how this happens |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I ran the following test.
Firstly with
go test -v -count 1
, then withgo test -v -count 1 ./
.The test requires an auxiliar bash script "tmp.sh" (with execution permissions):
What did you expect to see?
I expected a similar execution time, (waiting or not for the grandchild to exit). In fact, in both cases the test gets done is ~2 seconds, but in the "./" case,
go test
only returns when the grand child (the "sleep" command) ends.What did you see instead?
Additional info
I found that if I don't pass the stdtin, stdout and stderr file descriptors the issue doesn't appear.
The text was updated successfully, but these errors were encountered: