mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-24 17:50:15 +09:00
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:
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user