summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-25 14:48:12 -0600
committermo khan <mo@mokhan.ca>2025-07-25 14:48:12 -0600
commitff88a1c9d0ef76c2692343bf0ed6bbf4832080e6 (patch)
tree5208ebfdb9e7a680913ac4acc999a428dbb6868a /vendor
parent52d9fb110acdc5ba384d41518ecef918624a98e3 (diff)
chore: upgrade minit to include process restarts
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/xlgmokha/minit/main.go24
-rw-r--r--vendor/modules.txt2
2 files changed, 21 insertions, 5 deletions
diff --git a/vendor/github.com/xlgmokha/minit/main.go b/vendor/github.com/xlgmokha/minit/main.go
index 7ec6200..8fcf0e0 100644
--- a/vendor/github.com/xlgmokha/minit/main.go
+++ b/vendor/github.com/xlgmokha/minit/main.go
@@ -7,7 +7,9 @@ import (
"os/signal"
"strings"
"sync"
+ "sync/atomic"
"syscall"
+ "time"
)
func main() {
@@ -16,6 +18,7 @@ func main() {
var cmds []*exec.Cmd
var wg sync.WaitGroup
+ var shutdown int32
scanner := bufio.NewScanner(file)
for scanner.Scan() {
@@ -42,11 +45,22 @@ func main() {
cmds = append(cmds, cmd)
wg.Add(1)
- go func(c *exec.Cmd) {
+ go func(args []string) {
defer wg.Done()
- c.Start()
- c.Wait()
- }(cmd)
+ for atomic.LoadInt32(&shutdown) == 0 {
+ cmd := exec.Command(args[0], args[1:]...)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
+
+ if cmd.Start() != nil {
+ time.Sleep(2 * time.Second)
+ continue
+ }
+ cmd.Wait()
+ time.Sleep(time.Second)
+ }
+ }(args)
}
sigChan := make(chan os.Signal, 1)
@@ -54,6 +68,8 @@ func main() {
go func() {
<-sigChan
+ atomic.StoreInt32(&shutdown, 1)
+
for _, cmd := range cmds {
if cmd.Process != nil {
syscall.Kill(-cmd.Process.Pid, syscall.SIGTERM)
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 4dab1c0..59f7710 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -929,7 +929,7 @@ github.com/tklauser/numcpus
# github.com/xlab/treeprint v1.2.0
## explicit; go 1.13
github.com/xlab/treeprint
-# github.com/xlgmokha/minit v0.0.0-20250708214413-725b9f91042d
+# github.com/xlgmokha/minit v0.0.0-20250725204255-8e0834741617
## explicit; go 1.24
github.com/xlgmokha/minit
# github.com/xlgmokha/x v0.0.0-20250724192332-f79ef71d5cac