@node News
@unnumbered News
+@anchor{Release 1_17_0}
+@section Release 1.17.0
+@itemize
+@item
+ If @command{redo*} process is killed, then it sends @code{SIGTERM}
+ to all his children too, properly terminating the whole job queue.
+@end itemize
+
@anchor{Release 1_16_0}
@section Release 1.16.0
@itemize
"fmt"
"log"
"os"
- "os/signal"
"regexp"
"strconv"
"sync"
- "syscall"
)
const (
jsTokens[jsToken]++
jsRelease("ifchange entered", jsToken)
}
-
- killed := make(chan os.Signal, 0)
- signal.Notify(killed, syscall.SIGTERM, syscall.SIGINT)
- go func() {
- <-killed
- jsTokensM.Lock()
- for token, i := range jsTokens {
- for ; i > 0; i-- {
- jsReleaseNoLock(token)
- }
- }
- jsTokensM.Unlock()
- os.Exit(1)
- }()
}
func jsReleaseNoLock(token byte) {
jsTokensM.Unlock()
}
+func jsReleaseAll() {
+ jsTokensM.Lock()
+ for token, i := range jsTokens {
+ for ; i > 0; i-- {
+ jsReleaseNoLock(token)
+ }
+ }
+ jsTokensM.Unlock()
+}
+
func jsAcquire(ctx string) byte {
if JSR == nil {
return BMakeGoodToken
"io/ioutil"
"log"
"os"
+ "os/signal"
"path"
"path/filepath"
"runtime"
"sort"
"strconv"
+ "syscall"
"go.cypherpunks.ru/recfile"
"golang.org/x/sys/unix"
}
}
+ killed := make(chan os.Signal, 0)
+ signal.Notify(killed, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM)
+ go func() {
+ <-killed
+ trace(CDebug, "[%s] killed", BuildUUID)
+ jsReleaseAll()
+ RunningProcsM.Lock()
+ for pid, proc := range RunningProcs {
+ trace(CDebug, "[%s] killing child %d", BuildUUID, pid)
+ proc.Signal(syscall.SIGTERM)
+ }
+ os.Exit(1)
+ }()
+
ok := true
err = nil
trace(
flagStderrSilent *bool
TracedAll bool
+
+ RunningProcs = map[int]*os.Process{}
+ RunningProcsM sync.Mutex
)
func init() {
errs <- runErr
return
}
+ RunningProcsM.Lock()
+ RunningProcs[cmd.Process.Pid] = cmd.Process
+ RunningProcsM.Unlock()
pid := fmt.Sprintf("[%d]", cmd.Process.Pid)
trace(CDebug, "%s runs %s", tgtOrig, pid)
// Wait for job completion
<-stderrTerm
err = cmd.Wait()
+ RunningProcsM.Lock()
+ delete(RunningProcs, cmd.Process.Pid)
+ RunningProcsM.Unlock()
finished = time.Now()
runErr.Finished = &finished
if err != nil {
)
const (
- Version = "1.16.0"
+ Version = "1.17.0"
Warranty = `Copyright (C) 2020-2021 Sergey Matveev
This program is free software: you can redistribute it and/or modify