From 982e828c7c4b17d0b8b6ca150c9c13c436da09ea Mon Sep 17 00:00:00 2001 From: prog-supdex Date: Wed, 13 Mar 2024 15:39:19 +0100 Subject: [PATCH] fix by codereview --- start/process.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/start/process.go b/start/process.go index 43744be..b18c8bd 100644 --- a/start/process.go +++ b/start/process.go @@ -16,7 +16,8 @@ const SIGINFO syscall.Signal = 29 type process struct { output *multiOutput - pid int + pid int + paneID string stopSignal syscall.Signal canDie bool @@ -26,7 +27,6 @@ type process struct { dead bool interrupted bool restart bool - paneID string tmux *tmuxClient @@ -176,8 +176,7 @@ func (p *process) observe() { if !p.Running() { if !p.keepingAlive { p.out.Close() - - p.reportExitCode() + p.output.WriteBoldLinef(p, "Exited with code %d", p.tmux.PaneExitCode(p.paneID)) p.keepingAlive = true } @@ -211,10 +210,3 @@ func (p *process) respawn() { p.waitPid() p.output.WriteBoldLinef(p, "Restarted with pid %v...", p.pid) } - -func (p *process) reportExitCode() { - exitCode := p.tmux.PaneExitCode(p.paneID) - message := fmt.Sprintf("Exited with code %d", exitCode) - - p.output.WriteBoldLine(p, []byte(message)) -}