Skip to content

Commit

Permalink
fix: send SIGTERM signal to --cmd instead of SIGKILL
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhas07 committed Apr 17, 2024
1 parent 0b30dc5 commit 805a988
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/templ/generatecmd/run/run_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func KillAll() (err error) {
m.Lock()
defer m.Unlock()
for _, cmd := range running {
err := syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
err := syscall.Kill(-cmd.Process.Pid, syscall.SIGTERM)
if err != nil {
return err
}
Expand All @@ -28,15 +28,15 @@ func KillAll() (err error) {
}

func Stop(cmd *exec.Cmd) (err error) {
return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
return syscall.Kill(-cmd.Process.Pid, syscall.SIGTERM)
}

func Run(ctx context.Context, workingDir, input string) (cmd *exec.Cmd, err error) {
m.Lock()
defer m.Unlock()
cmd, ok := running[input]
if ok {
if err = syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL); err != nil {
if err = syscall.Kill(-cmd.Process.Pid, syscall.SIGTERM); err != nil {
return cmd, err
}
delete(running, input)
Expand Down

0 comments on commit 805a988

Please sign in to comment.