Replace zyedidia/pty with upstream creack/pty

Bump zyedidia/terminal, which is the actual dependency. We can get the
information we need from the Term's pty file rather than using a buffer
connected to stdout.

Fixes #2775
This commit is contained in:
Zachary Yedidia
2023-03-15 13:14:33 -07:00
parent dda79ca70e
commit 7bef54856c
3 changed files with 9 additions and 8 deletions

View File

@@ -2,6 +2,7 @@ package shell
import (
"bytes"
"io"
"os/exec"
"strconv"
@@ -79,7 +80,7 @@ func (t *Terminal) Start(execCmd []string, getOutput bool, wait bool, callback f
if getOutput {
t.output = bytes.NewBuffer([]byte{})
}
Term, _, err := terminal.Start(&t.State, cmd, t.output)
Term, _, err := terminal.Start(&t.State, cmd)
if err != nil {
return err
}
@@ -128,11 +129,12 @@ func (t *Terminal) Close() {
// call the lua function that the user has given as a callback
if t.getOutput {
if t.callback != nil {
b, _ := io.ReadAll(t.Term.File())
Jobs <- JobFunction{
Function: func(out string, args []interface{}) {
t.callback(out)
},
Output: t.output.String(),
Output: string(b),
Args: nil,
}
}