mirror of
https://github.com/numtide/treefmt.git
synced 2024-07-07 04:56:24 +03:00
fix: stop hard-killing formatters
Give the processes some chance to clean after themselves. Fixes https://github.com/numtide/treefmt/issues/316#issuecomment-2160628891
This commit is contained in:
parent
6b591255b1
commit
c68261e979
|
@ -66,6 +66,10 @@ func (f *Formatter) Apply(ctx context.Context, tasks []*Task) error {
|
|||
|
||||
// execute the command
|
||||
cmd := exec.CommandContext(ctx, f.executable, args...)
|
||||
// replace the default Cancel handler installed by CommandContext because it sends SIGKILL (-9).
|
||||
cmd.Cancel = func() error {
|
||||
return cmd.Process.Signal(os.Interrupt)
|
||||
}
|
||||
cmd.Dir = f.workingDir
|
||||
|
||||
// log out the command being executed
|
||||
|
|
Loading…
Reference in New Issue
Block a user