From f6d96d1a78877168b9b02e2b6de530b9dce66fe5 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Mon, 27 May 2024 17:11:21 +0900 Subject: [PATCH] fix: wait non-nil process --- pty_related_unix.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pty_related_unix.go b/pty_related_unix.go index 3f9f6ca..8c8f151 100644 --- a/pty_related_unix.go +++ b/pty_related_unix.go @@ -31,9 +31,11 @@ func (s *Server) createPty(shell string, connection ssh.Channel) (*os.File, erro Status: 0, })) connection.Close() - _, err := sh.Process.Wait() - if err != nil { - s.Logger.Info("failed to exit shell", err) + if sh.Process != nil { + _, err := sh.Process.Wait() + if err != nil { + s.Logger.Info("failed to exit shell", err) + } } s.Logger.Info("session closed") }