From 0d8462cfe7bfb66438ae7ccc8ec04c691617a247 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 23 Jun 2018 15:42:41 +0200 Subject: [PATCH] ssh: send exit-status request for successful commands The crypto/ssh client library requires this. --- ssh.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ssh.go b/ssh.go index 0a801a8..4253934 100644 --- a/ssh.go +++ b/ssh.go @@ -161,6 +161,10 @@ func (s *session) request(req *ssh.Request) error { return err } + // See https://tools.ietf.org/html/rfc4254#section-6.10 + if _, err := s.channel.SendRequest("exit-status", false /* wantReply */, []byte("\x00\x00\x00\x00")); err != nil { + return err + } s.channel.Close() return nil }