Created
June 16, 2019 19:38
-
-
Save gcla/29628006828e57ece336554f26e0bde9 to your computer and use it in GitHub Desktop.
Run gowid applications in a different tty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tscreen_linux.go b/tscreen_linux.go | |
index 79602f4..6514956 100644 | |
--- a/tscreen_linux.go | |
+++ b/tscreen_linux.go | |
@@ -33,10 +33,19 @@ func (t *tScreen) termioInit() error { | |
var ioc uintptr | |
t.tiosp = &termiosPrivate{} | |
- if t.in, e = os.OpenFile("/dev/tty", os.O_RDONLY, 0); e != nil { | |
+ intty := "/dev/tty" | |
+ outtty := "/dev/tty" | |
+ | |
+ gwtty := os.Getenv("GOWID_TTY") | |
+ if gwtty != "" { | |
+ intty = gwtty | |
+ outtty = gwtty | |
+ } | |
+ | |
+ if t.in, e = os.OpenFile(intty, os.O_RDONLY, 0); e != nil { | |
goto failed | |
} | |
- if t.out, e = os.OpenFile("/dev/tty", os.O_WRONLY, 0); e != nil { | |
+ if t.out, e = os.OpenFile(outtty, os.O_WRONLY, 0); e != nil { | |
goto failed | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment