Skip to content

proposal: os/exec: add option to send Interrupt instead of Kill on Context cancellation #22757

@andreynering

Description

@andreynering

The reason is that some executables do cleanup on Interrupt, like deleting temporary files.

Ideally it should send Interrupt but force a Kill after a timeout (of 2 seconds?). Also, it should be no-op on Windows that don't support sending Interrupt (and just send Kill instead).

It's already possible to manually listen to the Context and send the signals, but go test -race indicates a race when doing so, which I think it's not fixable because the internal mutex is unexported.

Background:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions