@@ -25,19 +25,18 @@ import (
25
25
"golang.org/x/xerrors"
26
26
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
27
27
28
- "github.com/coder/retry"
29
- "github.com/coder/serpent"
30
-
31
28
"cdr.dev/slog"
32
29
"cdr.dev/slog/sloggers/sloghuman"
33
-
34
30
"github.com/coder/coder/v2/cli/cliui"
35
31
"github.com/coder/coder/v2/cli/cliutil"
32
+ "github.com/coder/coder/v2/cli/xterminal"
36
33
"github.com/coder/coder/v2/coderd/autobuild/notify"
37
34
"github.com/coder/coder/v2/coderd/util/ptr"
38
35
"github.com/coder/coder/v2/codersdk"
39
36
"github.com/coder/coder/v2/codersdk/workspacesdk"
40
37
"github.com/coder/coder/v2/cryptorand"
38
+ "github.com/coder/retry"
39
+ "github.com/coder/serpent"
41
40
)
42
41
43
42
var (
@@ -341,15 +340,22 @@ func (r *RootCmd) ssh() *serpent.Command {
341
340
}
342
341
}
343
342
344
- stdoutFile , validOut := inv .Stdout .(* os.File )
345
343
stdinFile , validIn := inv .Stdin .(* os.File )
346
- if validOut && validIn && isatty .IsTerminal (stdoutFile .Fd ()) {
347
- state , err := term .MakeRaw (int (stdinFile .Fd ()))
344
+ stdoutFile , validOut := inv .Stdout .(* os.File )
345
+ if validIn && validOut && isatty .IsTerminal (stdinFile .Fd ()) && isatty .IsTerminal (stdoutFile .Fd ()) {
346
+ inState , err := xterminal .MakeInputRaw (stdinFile .Fd ())
347
+ if err != nil {
348
+ return err
349
+ }
350
+ defer func () {
351
+ _ = xterminal .Restore (stdinFile .Fd (), inState )
352
+ }()
353
+ outState , err := xterminal .MakeOutputRaw (stdoutFile .Fd ())
348
354
if err != nil {
349
355
return err
350
356
}
351
357
defer func () {
352
- _ = term .Restore (int ( stdinFile .Fd ()), state )
358
+ _ = xterminal .Restore (stdoutFile .Fd (), outState )
353
359
}()
354
360
355
361
windowChange := listenWindowSize (ctx )
0 commit comments