From c7b5b7e4c4028ce538d44283c3b034f67189356a Mon Sep 17 00:00:00 2001 From: Konikz Date: Tue, 22 Apr 2025 21:24:43 +0530 Subject: [PATCH] fix: avoid duplicate READY message when shell is already running This commit modifies the start.go file to check for an existing shell session (via ssh.pid) before showing the READY message. This prevents duplicate READY messages when the shell is already launched. Signed-off-by: Konikz --- pkg/instance/start.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/instance/start.go b/pkg/instance/start.go index b53de08183a..12b9be1a892 100644 --- a/pkg/instance/start.go +++ b/pkg/instance/start.go @@ -313,6 +313,13 @@ func watchHostAgentEvents(ctx context.Context, inst *store.Instance, haStdoutPat if *inst.Config.Plain { logrus.Infof("READY. Run `ssh -F %q %s` to open the shell.", inst.SSHConfigFile, inst.Hostname) } else { + // Check if a shell session is already running + if _, err := os.Stat(filepath.Join(inst.Dir, "ssh.pid")); err == nil { + // Shell session exists, skip the READY message + _ = ShowMessage(inst) + err = nil + return true + } logrus.Infof("READY. Run `%s` to open the shell.", LimactlShellCmd(inst.Name)) } _ = ShowMessage(inst)