From 02e9fa086d730237387a5abccffc2360444d1cf6 Mon Sep 17 00:00:00 2001 From: nate smith Date: Wed, 28 Apr 2021 13:59:54 -0500 Subject: [PATCH] start on incorrect function error handling --- cmd/gh/main.go | 6 ++++++ pkg/cmd/root/help_topic.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/cmd/gh/main.go b/cmd/gh/main.go index 31e90d3fb..57af7b966 100644 --- a/cmd/gh/main.go +++ b/cmd/gh/main.go @@ -176,6 +176,12 @@ func mainRun() exitCode { printError(stderr, err, cmd, hasDebug) + if strings.Contains(err.Error(), "Incorrect function") { + fmt.Fprintln(stderr, "You appear to be running in MinTTY without pseudo terminal support.") + fmt.Fprintln(stderr, "To learn about workarounds for this error, gh help mintty") + return exitError + } + var httpErr api.HTTPError if errors.As(err, &httpErr) && httpErr.StatusCode == 401 { fmt.Fprintln(stderr, "hint: try authenticating with `gh auth login`") diff --git a/pkg/cmd/root/help_topic.go b/pkg/cmd/root/help_topic.go index 2b4abe12c..90f157c6b 100644 --- a/pkg/cmd/root/help_topic.go +++ b/pkg/cmd/root/help_topic.go @@ -6,6 +6,12 @@ import ( ) var HelpTopics = map[string]map[string]string{ + "mintty": { + "short": "Information about using gh with MinTTY", + "long": heredoc.Doc(` + TODO + `), + }, "environment": { "short": "Environment variables that can be used with gh", "long": heredoc.Doc(`