Skip to content

Commit

Permalink
Merge branch 'master' into profiles2
Browse files Browse the repository at this point in the history
  • Loading branch information
gcla committed Jun 26, 2022
2 parents 4cc4668 + 2fddcc4 commit b9a1c6a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
7 changes: 3 additions & 4 deletions cmd/termshark/termshark.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ func cmain() int {
// using the gcla fork of tcell for another application).
usetty = "/dev/tty"
}
os.Setenv("GOWID_TTY", usetty)

// Allow the user to override the shell's TERM variable this way. Perhaps the user runs
// under screen/tmux, and the TERM variable doesn't reflect the fact their preferred
Expand Down Expand Up @@ -846,7 +845,7 @@ func cmain() int {
}
}()

if app, err = ui.Build(); err != nil {
if app, err = ui.Build(usetty); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
// Tcell returns ExitError now because if its internal terminfo DB does not have
// a matching entry, it tries to build one with infocmp.
Expand Down Expand Up @@ -1176,7 +1175,7 @@ Loop:
appRunner.Start()

// Reinstate our terminal overrides that allow ctrl-z
if err := ctrlzLineDisc.Set(); err != nil {
if err := ctrlzLineDisc.Set(usetty); err != nil {
ui.OpenError(fmt.Sprintf("Unexpected error setting Ctrl-z handler: %v\n", err), app)
}

Expand Down Expand Up @@ -1274,7 +1273,7 @@ Loop:
appRunner.Start()

// Reinstate our terminal overrides that allow ctrl-z
if err := ctrlzLineDisc.Set(); err != nil {
if err := ctrlzLineDisc.Set(usetty); err != nil {
ui.OpenError(fmt.Sprintf("Unexpected error setting Ctrl-z handler: %v\n", err), app)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/blang/semver v3.5.1+incompatible
github.com/flytam/filenamify v1.1.0
github.com/gcla/deep v1.0.2
github.com/gcla/gowid v1.3.1-0.20220603022106-4d04cba8013a
github.com/gcla/gowid v1.3.1-0.20220626203558-a594805196f2
github.com/gcla/tail v1.0.1-0.20190505190527-650e90873359
github.com/gcla/term v0.0.0-20220601234708-3e6af2ebff27
github.com/gdamore/tcell/v2 v2.5.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ github.com/gcla/deep v1.0.2 h1:qBOx6eepcOSRYnHJ+f2ih4hP4Vca1YnLtXxp73n5KWI=
github.com/gcla/deep v1.0.2/go.mod h1:evE9pbpSGhItmFoBIk8hPOIC/keKTGYhFl6Le1Av+GE=
github.com/gcla/gowid v1.3.1-0.20220603022106-4d04cba8013a h1:8kh1ORv/P5ruPPoZBMrXAxw406+o9Uvg4fPblsMfcUo=
github.com/gcla/gowid v1.3.1-0.20220603022106-4d04cba8013a/go.mod h1:7T4Xzfznq31XvQyAOX+SZzQjvF7RX16mjXDXGB7R/44=
github.com/gcla/gowid v1.3.1-0.20220626203558-a594805196f2 h1:lTVa5VHxePP+1aMijXK0+McQdHL6RFFciSFp6VZ+oEk=
github.com/gcla/gowid v1.3.1-0.20220626203558-a594805196f2/go.mod h1:7T4Xzfznq31XvQyAOX+SZzQjvF7RX16mjXDXGB7R/44=
github.com/gcla/tail v1.0.1-0.20190505190527-650e90873359 h1:3xEhacR7pIJV8daurdBygptxhzTJeYFqJp1V6SDl+pE=
github.com/gcla/tail v1.0.1-0.20190505190527-650e90873359/go.mod h1:Wn+pZpM98JHSOYkPDtmdvlqmc0OzQGHWOsHB2d28WtQ=
github.com/gcla/term v0.0.0-20220601234708-3e6af2ebff27 h1:OmzD2vZl1UeSblMmUo4mKjnrtsn+VLxhkkqnDOPHrXY=
Expand Down
9 changes: 1 addition & 8 deletions tty/tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,11 @@ func (t *TerminalSignals) Restore() {
t.set = false
}

func (t *TerminalSignals) Set() error {
func (t *TerminalSignals) Set(outtty string) error {
var e error
var newtios unix.Termios
var fd uintptr

outtty := "/dev/tty"

gwtty := os.Getenv("GOWID_TTY")
if gwtty != "" {
outtty = gwtty
}

if t.out, e = os.OpenFile(outtty, os.O_WRONLY, 0); e != nil {
goto failed
}
Expand Down
3 changes: 2 additions & 1 deletion ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -3289,7 +3289,7 @@ func ApplyCurrentTheme(app gowid.IApp) {

//======================================================================

func Build() (*gowid.App, error) {
func Build(tty string) (*gowid.App, error) {

var err error
var app *gowid.App
Expand Down Expand Up @@ -4358,6 +4358,7 @@ func Build() (*gowid.App, error) {
Log: log.StandardLogger(),
EnableBracketedPaste: true,
DontActivate: true,
Tty: tty,
})

if err != nil {
Expand Down

0 comments on commit b9a1c6a

Please sign in to comment.