Return proper exit code on ssh with TTY (#3192)

* Return proper exit code on ssh with TTY

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix revive lint

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix Windows exit code for missing command

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix close error handling on agent TTY

Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
Spike Curtis
2022-07-27 12:23:28 -07:00
committed by GitHub
parent a37e61a099
commit 36ffdce065
11 changed files with 184 additions and 27 deletions
+1 -2
View File
@@ -5,7 +5,6 @@ import (
"bytes"
"context"
"io"
"os"
"os/exec"
"runtime"
"strings"
@@ -27,7 +26,7 @@ func New(t *testing.T) *PTY {
return create(t, ptty, "cmd")
}
func Start(t *testing.T, cmd *exec.Cmd) (*PTY, *os.Process) {
func Start(t *testing.T, cmd *exec.Cmd) (*PTY, pty.Process) {
ptty, ps, err := pty.Start(cmd)
require.NoError(t, err)
return create(t, ptty, cmd.Args[0]), ps