From 5ac57b8b1176b4a5af835f41280864341b38075a Mon Sep 17 00:00:00 2001 From: YOUR_FULL_NAME Date: Wed, 29 Jul 2026 13:43:27 -0700 Subject: [PATCH] Fail and exit early if the shell terminal size is 0 --- pkg/flink/app/application.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/flink/app/application.go b/pkg/flink/app/application.go index ea5e9a312b..4d7b1e34ad 100644 --- a/pkg/flink/app/application.go +++ b/pkg/flink/app/application.go @@ -85,6 +85,9 @@ func StartApp(gatewayClient ccloudv2.GatewayClientInterface, tokenRefreshFunc fu utils.OutputErr("Error: failed to initialize console parser") return errors.NewErrorWithSuggestions("failed to initialize console parser", "Restart your shell session or try another terminal.") } + if winSize := consoleParser.GetWinSize(); winSize != nil && (winSize.Col == 0 || winSize.Row == 0) { + return errors.NewErrorWithSuggestions("failed to determine terminal size or terminal size is 0", "Check that your terminal window has valid dimensions.") + } appController.AddCleanupFunction(func() { utils.TearDownConsoleParser(consoleParser) utils.RestoreStdin(stdinBefore) @@ -149,6 +152,9 @@ func StartAppOnPrem(flinkCmfClient *flink.CmfRestClient, tokenRefreshFunc func() utils.OutputErr("Error: failed to initialize console parser") return errors.NewErrorWithSuggestions("failed to initialize console parser", "Restart your shell session or try another terminal.") } + if winSize := consoleParser.GetWinSize(); winSize != nil && (winSize.Col == 0 || winSize.Row == 0) { + return errors.NewErrorWithSuggestions("failed to determine terminal size or terminal size is 0", "Check that your terminal window has valid dimensions.") + } appController.AddCleanupFunction(func() { utils.TearDownConsoleParser(consoleParser) utils.RestoreStdin(stdinBefore)