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) {
tries := 0
removeIndexes := make([]int, 0)
for {
tries++
allFinished := true
for _, cmd := range commands {
for i, cmd := range commands {
if cmd.cmd.Process == nil {
allFinished = false
@ -65,6 +66,7 @@ func KillAll(skipFlag ...RunFlag) {
args := strings.Join(cmd.cmd.Args, " ")
slog.Debug("process is not running after 50 tries, breaking.", slog.String("command", args))
allFinished = true
removeIndexes = append(removeIndexes, i)
break
} else {
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 {
if shouldSkipKilling(command.flags, skipFlag) {
continue