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

Add "kill" command to terminate background exec #242

Closed kortschak closed 2 months ago

kortschak commented 6 months ago

I am using testscript to test the behaviour of a program that is not intended to terminate in production. I would like to examine its output while running for a period, but it is not possible to obtain stdout/stderr until a background exec has terminated. To achieve this I would like to be able to

cmd &name&
sleep 1s
kill name
wait name # depending on implementation of kill this may or may not be necessary.

stdout <pattern>
stderr <pattern>

I am able to add the sleep, but access to the exec's termination details are not exposed, so the script cannot terminate the exec unless invoking stop, which would defeat the test.

ldemailly commented 6 months ago

is that covering #195 too?

kortschak commented 6 months ago

I didn't see that. Yes, it would cover that.