diff --git a/cmd/coder/main.go b/cmd/coder/main.go index 46e0850574a99..1c22d578d7160 100644 --- a/cmd/coder/main.go +++ b/cmd/coder/main.go @@ -5,6 +5,8 @@ import ( "os" _ "time/tzdata" + tea "github.com/charmbracelet/bubbletea" + "github.com/coder/coder/v2/agent/agentexec" "github.com/coder/coder/v2/cli" ) @@ -15,6 +17,9 @@ func main() { _, _ = fmt.Fprintln(os.Stderr, err) os.Exit(1) } + // This preserves backwards compatibility with an init function that is causing grief for + // web terminals using agent-exec + screen. See https://github.com/coder/coder/pull/15817 + tea.InitTerminal() var rootCmd cli.RootCmd rootCmd.RunWithSubcommands(rootCmd.AGPL()) } diff --git a/enterprise/cmd/coder/main.go b/enterprise/cmd/coder/main.go index c71e479fe0079..803903f390e5a 100644 --- a/enterprise/cmd/coder/main.go +++ b/enterprise/cmd/coder/main.go @@ -5,6 +5,8 @@ import ( "os" _ "time/tzdata" + tea "github.com/charmbracelet/bubbletea" + "github.com/coder/coder/v2/agent/agentexec" entcli "github.com/coder/coder/v2/enterprise/cli" ) @@ -15,7 +17,9 @@ func main() { _, _ = fmt.Fprintln(os.Stderr, err) os.Exit(1) } - + // This preserves backwards compatibility with an init function that is causing grief for + // web terminals using agent-exec + screen. See https://github.com/coder/coder/pull/15817 + tea.InitTerminal() var rootCmd entcli.RootCmd rootCmd.RunWithSubcommands(rootCmd.EnterpriseSubcommands()) } diff --git a/go.mod b/go.mod index fc5b6d394b26a..acb6ab5e0b7e5 100644 --- a/go.mod +++ b/go.mod @@ -67,6 +67,10 @@ replace github.com/pkg/sftp => github.com/mafredri/sftp v1.13.6-0.20231212144145 // which we use in the awsiamrds package. replace github.com/lib/pq => github.com/coder/pq v1.10.5-0.20240813183442-0c420cb5a048 +// Removes an init() function that causes terminal sequences to be printed to the web terminal when +// used in conjunction with agent-exec. See https://github.com/coder/coder/pull/15817 +replace github.com/charmbracelet/bubbletea => github.com/coder/bubbletea v1.2.2-0.20241212190825-007a1cdb2c41 + require ( cdr.dev/slog v1.6.2-0.20241112041820-0ec81e6e67bb cloud.google.com/go/compute/metadata v0.5.2 @@ -202,7 +206,7 @@ require go.uber.org/mock v0.5.0 require ( github.com/cespare/xxhash v1.1.0 github.com/charmbracelet/bubbles v0.20.0 - github.com/charmbracelet/bubbletea v1.2.1 + github.com/charmbracelet/bubbletea v1.1.0 github.com/charmbracelet/lipgloss v1.0.0 github.com/coder/serpent v0.10.0 github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 diff --git a/go.sum b/go.sum index 6483c3505565c..bb9c265232652 100644 --- a/go.sum +++ b/go.sum @@ -177,8 +177,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE= github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU= -github.com/charmbracelet/bubbletea v1.2.1 h1:J041h57zculJKEKf/O2pS4edXGIz+V0YvojvfGXePIk= -github.com/charmbracelet/bubbletea v1.2.1/go.mod h1:viLoDL7hG4njLJSKU2gw7kB3LSEmWsrM80rO1dBJWBI= github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs= github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw= github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg= @@ -209,6 +207,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/coder/bubbletea v1.2.2-0.20241212190825-007a1cdb2c41 h1:SBN/DA63+ZHwuWwPHPYoCZ/KLAjHv5g4h2MS4f2/MTI= +github.com/coder/bubbletea v1.2.2-0.20241212190825-007a1cdb2c41/go.mod h1:I9ULxr64UaOSUv7hcb3nX4kowodJCVS7vt7VVJk/kW4= github.com/coder/flog v1.1.0 h1:kbAes1ai8fIS5OeV+QAnKBQE22ty1jRF/mcAwHpLBa4= github.com/coder/flog v1.1.0/go.mod h1:UQlQvrkJBvnRGo69Le8E24Tcl5SJleAAR7gYEHzAmdQ= github.com/coder/glog v1.0.1-0.20220322161911-7365fe7f2cd1 h1:UqBrPWSYvRI2s5RtOul20JukUEpu4ip9u7biBL+ntgk=