diff --git a/m/pagermode-viewing.go b/m/pagermode-viewing.go index fd56920..9e189ac 100644 --- a/m/pagermode-viewing.go +++ b/m/pagermode-viewing.go @@ -5,6 +5,7 @@ import ( "math" "os" "os/exec" + "runtime" "strings" log "github.com/sirupsen/logrus" @@ -111,13 +112,19 @@ func errUnlessExecutable(file string) error { if err != nil { return fmt.Errorf("Failed to stat %s: %w", file, err) } - if stat.Mode()&0111 == 0 { - // Note that this check isn't perfect, it could still be executable but - // not by us. Corner case, let's just fail later in that case. - return fmt.Errorf("Not executable: %s", file) + + if runtime.GOOS == "windows" && strings.HasSuffix(strings.ToLower(file), ".exe") { + log.Debug(".exe file on Windows, assuming executable: ", file) + return nil } - return nil + if stat.Mode()&0111 != 0 { + // Note that this check isn't perfect, it could still be executable but + // not by us. Corner case, let's just fail later in that case. + return nil + } + + return fmt.Errorf("Not executable: %s", file) } func handleEditingRequest(p *Pager) { diff --git a/moar.go b/moar.go index 9f63ff7..763f097 100644 --- a/moar.go +++ b/moar.go @@ -280,6 +280,7 @@ func printProblemsHeader() { fmt.Fprintln(os.Stderr, "LANG :", os.Getenv("LANG")) fmt.Fprintln(os.Stderr, "TERM :", os.Getenv("TERM")) fmt.Fprintln(os.Stderr, "MOAR :", os.Getenv("MOAR")) + fmt.Fprintln(os.Stderr, "EDITOR :", os.Getenv("EDITOR")) fmt.Fprintln(os.Stderr) fmt.Fprintln(os.Stderr, "GOOS :", runtime.GOOS) fmt.Fprintln(os.Stderr, "GOARCH :", runtime.GOARCH)