Skip to content

Commit 02e9fa0

Browse files
author
nate smith
committed
start on incorrect function error handling
1 parent d5954e2 commit 02e9fa0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cmd/gh/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ func mainRun() exitCode {
176176

177177
printError(stderr, err, cmd, hasDebug)
178178

179+
if strings.Contains(err.Error(), "Incorrect function") {
180+
fmt.Fprintln(stderr, "You appear to be running in MinTTY without pseudo terminal support.")
181+
fmt.Fprintln(stderr, "To learn about workarounds for this error, gh help mintty")
182+
return exitError
183+
}
184+
179185
var httpErr api.HTTPError
180186
if errors.As(err, &httpErr) && httpErr.StatusCode == 401 {
181187
fmt.Fprintln(stderr, "hint: try authenticating with `gh auth login`")

pkg/cmd/root/help_topic.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import (
66
)
77

88
var HelpTopics = map[string]map[string]string{
9+
"mintty": {
10+
"short": "Information about using gh with MinTTY",
11+
"long": heredoc.Doc(`
12+
TODO
13+
`),
14+
},
915
"environment": {
1016
"short": "Environment variables that can be used with gh",
1117
"long": heredoc.Doc(`

0 commit comments

Comments
 (0)