Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 0562f8b

Browse files
committed
fixup! Set output correctly
Change-Id: I2cabc97b47223d2737845cac7acac37965221fa9
1 parent 28475c1 commit 0562f8b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cmd/coder/shell.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
9797
env = findEnv(entClient, envName)
9898
)
9999

100-
termfd := os.Stdin.Fd()
100+
termfd := os.Stdout.Fd()
101101

102102
tty := terminal.IsTerminal(int(termfd))
103103
if tty {
104-
stdinState, err := xterminal.MakeRaw(termfd)
104+
stdinState, err := xterminal.MakeRaw(os.Stdin.Fd())
105105
if err != nil {
106106
return err
107107
}
108-
defer xterminal.Restore(termfd, stdinState)
108+
defer xterminal.Restore(os.Stdin.Fd(), stdinState)
109109

110110
stdoutState, err := xterminal.MakeOutputRaw(os.Stdout.Fd())
111111
if err != nil {
@@ -123,13 +123,18 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
123123
}
124124
go heartbeat(ctx, conn, 15*time.Second)
125125

126+
term := os.Getenv("TERM")
127+
if term == "" {
128+
term = "xterm" // TODO: fix this
129+
}
130+
126131
execer := wsep.RemoteExecer(conn)
127132
process, err := execer.Start(ctx, wsep.Command{
128133
Command: command,
129134
Args: args,
130135
TTY: tty,
131136
Stdin: true,
132-
Env: []string{"TERM=" + os.Getenv("TERM")},
137+
Env: []string{"TERM=" + term},
133138
})
134139
if err != nil {
135140
return err

0 commit comments

Comments
 (0)