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

Commit 5a6b14e

Browse files
committed
Set raw output for all commands
Change-Id: Id286904a99d3f3796a7679837ec4f168a273807c
1 parent 6fc2c8c commit 5a6b14e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

cmd/coder/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ import (
66
_ "net/http/pprof"
77
"os"
88

9+
"cdr.dev/coder-cli/internal/xterminal"
910
"github.com/spf13/pflag"
1011

12+
"go.coder.com/flog"
13+
1114
"go.coder.com/cli"
1215
)
1316

@@ -48,5 +51,12 @@ func main() {
4851
log.Println(http.ListenAndServe("localhost:6060", nil))
4952
}()
5053
}
54+
55+
stdoutState, err := xterminal.MakeOutputRaw(os.Stdout.Fd())
56+
if err != nil {
57+
flog.Fatal("failed to set output to raw: %v", err)
58+
}
59+
defer xterminal.Restore(os.Stdout.Fd(), stdoutState)
60+
5161
cli.RunRoot(&rootCmd{})
5262
}

cmd/coder/shell.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
9797
return err
9898
}
9999
defer xterminal.Restore(os.Stdin.Fd(), stdinState)
100-
101-
stdoutState, err := xterminal.MakeOutputRaw(os.Stdout.Fd())
102-
if err != nil {
103-
return err
104-
}
105-
defer xterminal.Restore(os.Stdout.Fd(), stdoutState)
106100
}
107101

108102
ctx, cancel := context.WithCancel(ctx)

0 commit comments

Comments
 (0)