handle clean shutdown

This commit is contained in:
Jesse de Wit
2023-01-23 14:54:55 +01:00
parent 294080b067
commit 5aad6b313e
6 changed files with 26 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ import (
"os/exec"
"path/filepath"
"sync"
"syscall"
"github.com/breez/lntest"
lspd "github.com/breez/lspd/rpc"
@@ -109,6 +110,7 @@ func (c *ClnLspNode) Start() {
})
cmd := exec.CommandContext(c.harness.Ctx, c.lspBase.scriptFilePath)
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
logFile, err := os.Create(c.logFilePath)
if err != nil {
lntest.PerformCleanup(cleanups)
@@ -136,7 +138,7 @@ func (c *ClnLspNode) Start() {
return nil
}
proc.Kill()
syscall.Kill(-proc.Pid, syscall.SIGINT)
log.Printf("About to wait for lspd to exit")
status, err := proc.Wait()