all repos — erl @ d29d0816680a343ee47c40fa9ace8d80862ac412

Execute Reload Loop

feat: apply ignores from .gitignore/.ignore files

Alan Pearce
commit

d29d0816680a343ee47c40fa9ace8d80862ac412

parent

a52be32962b55478c31d6f4e1139e4ab4b140100

1 file changed, 34 insertions(+), 0 deletions(-)

changed files
A testcases/runaway/runaway.go
@@ -0,0 +1,34 @@
+package main + +import ( + "context" + "fmt" + "os" + "os/exec" + "os/signal" + "syscall" + "time" +) + +func main() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + signal.NotifyContext(ctx, os.Interrupt, syscall.SIGHUP) + + cmd := exec.CommandContext(ctx, "sleep", "5") + + go func() { + for { + time.Sleep(5 * time.Second) + fmt.Println("I'm still alive!") + } + }() + + if err := cmd.Start(); err != nil { + panic("Error starting command: " + err.Error()) + } + + if err := cmd.Wait(); err != nil { + fmt.Printf("Error waiting for command: %v\n", err) + } +}