rogpeppe / go-internal

Selected Go-internal packages factored out from the standard library
BSD 3-Clause "New" or "Revised" License
823 stars 67 forks source link

testscript: interrupted background process should not cause a test to fail #260

Open rogpeppe opened 2 weeks ago

rogpeppe commented 2 weeks ago

It is usual and expected for processes to return a non-zero exit code when they are terminated with a signal. At the end of a test, testscript kills all background processes and then fails if any of them terminate with a non-zero exit code. This doesn't seem right. (It's even more wrong that it panics with an error code that should be internal-only - see issue #228).

Instead, at the end of a test, testscript should check if any background processes have already exited with a non-zero exit code and fail then, but otherwise it should interrupt them and ignore any non-zero exit codes from processes killed as a result.

mvdan commented 3 days ago

I'm currently looking into this, e.g. https://github.com/rogpeppe/go-internal/pull/261 to also test Windows.