Skip to content

Commit

Permalink
fix: stop hard-killing formatters
Browse files Browse the repository at this point in the history
Give the processes some chance to clean after themselves.

Fixes #316 (comment)
  • Loading branch information
zimbatm committed Jun 14, 2024
1 parent 6b59125 commit c68261e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions format/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c68261e

Please sign in to comment.