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: add kill command #243

Closed kortschak closed 2 months ago

kortschak commented 6 months ago

This allows sending a termination signal to backgrounded commands.

Please take a look.

Closes #242

kortschak commented 3 months ago

ping

As noted in the slack conversation about this PR, if adding a kill command is too much, an alternative would be to expose TestScript.findBackground so that client code can build the command within its test code.

mvdan commented 2 months ago

As noted in the slack conversation about this PR, if adding a kill command is too much, an alternative would be to expose TestScript.findBackground so that client code can build the command within its test code.

I would personally also be fine with this, but given that the majority of users would presumably use that to write their own kill commands, I'm fine with adding the command directly. We can always choose to expose the Go API later as well.