Skip to content

Commit c68261e

Browse files
committed
fix: stop hard-killing formatters
Give the processes some chance to clean after themselves. Fixes #316 (comment)
1 parent 6b59125 commit c68261e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

format/formatter.go

+4
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ func (f *Formatter) Apply(ctx context.Context, tasks []*Task) error {
6666

6767
// execute the command
6868
cmd := exec.CommandContext(ctx, f.executable, args...)
69+
// replace the default Cancel handler installed by CommandContext because it sends SIGKILL (-9).
70+
cmd.Cancel = func() error {
71+
return cmd.Process.Signal(os.Interrupt)
72+
}
6973
cmd.Dir = f.workingDir
7074

7175
// log out the command being executed

0 commit comments

Comments
 (0)