Use stdout as controlling terminal

Soves an issue with go1.15 not letting ctty be a parent. See
https://github.com/creack/pty/pull/97 for more details.

Signed-off-by: Guillaume J. Charmes <git+guillaume@charmes.net>
This commit is contained in:
Guillaume J. Charmes 2020-05-06 10:25:11 -04:00 committed by Drew DeVault
parent 38a6d187b9
commit dc281e46d2
3 changed files with 5 additions and 2 deletions

2
go.mod
View file

@ -4,7 +4,7 @@ go 1.13
require ( require (
git.sr.ht/~sircmpwn/getopt v0.0.0-20190808004552-daaf1274538b git.sr.ht/~sircmpwn/getopt v0.0.0-20190808004552-daaf1274538b
github.com/creack/pty v1.1.9 github.com/creack/pty v1.1.10-0.20200505162710-943a9a2171fd
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
github.com/ddevault/go-libvterm v0.0.0-20190526194226-b7d861da3810 github.com/ddevault/go-libvterm v0.0.0-20190526194226-b7d861da3810
github.com/emersion/go-imap v1.0.4 github.com/emersion/go-imap v1.0.4

2
go.sum
View file

@ -8,6 +8,8 @@ github.com/ProtonMail/crypto v0.0.0-20200420072808-71bec3603bf3 h1:JW27/kGLQzeM1
github.com/ProtonMail/crypto v0.0.0-20200420072808-71bec3603bf3/go.mod h1:Pxr7w4gA2ikI4sWyYwEffm+oew1WAJHzG1SiDpQMkrI= github.com/ProtonMail/crypto v0.0.0-20200420072808-71bec3603bf3/go.mod h1:Pxr7w4gA2ikI4sWyYwEffm+oew1WAJHzG1SiDpQMkrI=
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.10-0.20200505162710-943a9a2171fd h1:+9Ri1/EpsFbE2LIYRRYOHtYPs2Y0pgCOKgVywFyUi48=
github.com/creack/pty v1.1.10-0.20200505162710-943a9a2171fd/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

View file

@ -4,6 +4,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"sync" "sync"
"syscall"
"git.sr.ht/~sircmpwn/aerc/lib/ui" "git.sr.ht/~sircmpwn/aerc/lib/ui"
@ -237,7 +238,7 @@ func (term *Terminal) Draw(ctx *ui.Context) {
if term.pty == nil { if term.pty == nil {
term.vterm.SetSize(ctx.Height(), ctx.Width()) term.vterm.SetSize(ctx.Height(), ctx.Width())
tty, err := pty.StartWithSize(term.cmd, &winsize) tty, err := pty.StartWithAttrs(term.cmd, &winsize, &syscall.SysProcAttr{Setsid: true, Setctty: true, Ctty: 1})
term.pty = tty term.pty = tty
if err != nil { if err != nil {
term.Close(err) term.Close(err)