Skip to content

Commit 8aafd00

Browse files
committed
fix killing processes if command fails
1 parent 4248e6d commit 8aafd00

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

process/process_windows.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (pm *ProcessManager) StartProcess(ctx context.Context, cancel context.Cance
9999
select {
100100
case <-processCtx.Done():
101101
// slog.Warn("Killing Process", "exec", p.Exec, "pgid", p.pgid, "pid", p.pid)
102-
taskKill(p.pid)
102+
ctx.Done()
103103
// slog.Debug("Process Terminated", "exec", p.Exec)
104104
case <-ctx.Done():
105105
// slog.Debug("Context Done", "exec", p.Exec)
@@ -118,7 +118,7 @@ func (pm *ProcessManager) StartProcess(ctx context.Context, cancel context.Cance
118118
}
119119

120120
if err != nil {
121-
slog.Error("Running Command", "exec", p.Exec, "err", err)
121+
slog.Error("Executing command", "command", p.Exec, "err", err)
122122
cancel()
123123
}
124124
}
@@ -130,9 +130,6 @@ func (pm *ProcessManager) StartProcess(ctx context.Context, cancel context.Cance
130130
func (pm *ProcessManager) KillProcesses() {
131131
// slog.Debug("Killing Processes")
132132
for _, p := range pm.Processes {
133-
if p.pgid == 0 {
134-
continue
135-
}
136133
err := taskKill(p.pid)
137134
if err != nil {
138135
// slog.Error("Error killing process", "pid", p.cmd.Process.Pid, "err", err.Error())

0 commit comments

Comments
 (0)