why is this happening on windows

This commit is contained in:
maddalax 2024-09-23 16:12:04 -05:00
parent 84d3e9ce7b
commit 5949397c3f

View file

@ -54,10 +54,11 @@ func shouldSkipKilling(flags []RunFlag, skipFlag []RunFlag) bool {
func KillAll(skipFlag ...RunFlag) { func KillAll(skipFlag ...RunFlag) {
tries := 0 tries := 0
removeIndexes := make([]int, 0)
for { for {
tries++ tries++
allFinished := true allFinished := true
for _, cmd := range commands { for i, cmd := range commands {
if cmd.cmd.Process == nil { if cmd.cmd.Process == nil {
allFinished = false allFinished = false
@ -65,6 +66,7 @@ func KillAll(skipFlag ...RunFlag) {
args := strings.Join(cmd.cmd.Args, " ") args := strings.Join(cmd.cmd.Args, " ")
slog.Debug("process is not running after 50 tries, breaking.", slog.String("command", args)) slog.Debug("process is not running after 50 tries, breaking.", slog.String("command", args))
allFinished = true allFinished = true
removeIndexes = append(removeIndexes, i)
break break
} else { } else {
time.Sleep(time.Millisecond * 50) time.Sleep(time.Millisecond * 50)
@ -77,6 +79,10 @@ func KillAll(skipFlag ...RunFlag) {
} }
} }
for i := len(removeIndexes) - 1; i >= 0; i-- {
commands = append(commands[:removeIndexes[i]], commands[removeIndexes[i]+1:]...)
}
for _, command := range commands { for _, command := range commands {
if shouldSkipKilling(command.flags, skipFlag) { if shouldSkipKilling(command.flags, skipFlag) {
continue continue