diff options
| author | theimpostor <sahirhoda@gmail.com> | 2024-11-11 14:01:48 -0600 |
|---|---|---|
| committer | theimpostor <sahirhoda@gmail.com> | 2024-11-11 14:01:48 -0600 |
| commit | 6acbe36b9592bb9eded805db7f667343a56d4ad2 (patch) | |
| tree | a64992df08c406302593c169a49b137f783d8ef1 /main.go | |
| parent | 8f0d87986109ba3d02690aad2773e6512413dd1a (diff) | |
fix windows support
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -8,6 +8,7 @@ import ( "log" "os" "os/exec" + "runtime" "strings" "time" @@ -52,19 +53,9 @@ func encode(fname string, encoder io.WriteCloser) { } } -func opentty() (tty tcell.Tty, err error) { - device := ttyDevice() - debugLog.Println("Using tty device:", device) - tty, err = tcell.NewDevTtyFromDev(device) - if err == nil { - err = tty.Start() - } - return -} - func closetty(tty tcell.Tty) { - tty.Drain() - tty.Stop() + _ = tty.Drain() + _ = tty.Stop() tty.Close() } @@ -111,7 +102,11 @@ func identifyTerm() { if os.Getenv("TMUX") != "" { isTmux = true } else if ti, err := tcell.LookupTerminfo(os.Getenv("TERM")); err != nil { - errorLog.Println("Failed to lookup terminfo:", err) + if runtime.GOOS != "windows" { + errorLog.Println("Failed to lookup terminfo:", err) + } else { + debugLog.Println("On Windows, failed to lookup terminfo:", err) + } } else { debugLog.Printf("term name: %s, aliases: %q", ti.Name, ti.Aliases) if strings.HasPrefix(ti.Name, "screen") { |
