change liner source so that we can have good tty config
This commit is contained in:
parent
f69532d54c
commit
91498926d5
4 changed files with 14 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"github.com/peterh/liner"
|
"github.com/candid82/liner"
|
||||||
"gitlab.com/whom/shs/ast"
|
"gitlab.com/whom/shs/ast"
|
||||||
"gitlab.com/whom/shs/log"
|
"gitlab.com/whom/shs/log"
|
||||||
"gitlab.com/whom/shs/util"
|
"gitlab.com/whom/shs/util"
|
||||||
|
|
@ -109,6 +109,12 @@ func main() {
|
||||||
line := liner.NewLiner()
|
line := liner.NewLiner()
|
||||||
defer line.Close()
|
defer line.Close()
|
||||||
|
|
||||||
|
if !liner.TerminalSupported() {
|
||||||
|
log.Log(log.ERR,
|
||||||
|
"Terminal unsupported, continuing in dummy mode!",
|
||||||
|
"init")
|
||||||
|
}
|
||||||
|
|
||||||
line.SetCtrlCAborts(true)
|
line.SetCtrlCAborts(true)
|
||||||
line.SetCompleter(func(line string) (c []string) {
|
line.SetCompleter(func(line string) (c []string) {
|
||||||
return util.ShellCompleter(line, vars, funcs)
|
return util.ShellCompleter(line, vars, funcs)
|
||||||
|
|
|
||||||
1
go.mod
1
go.mod
|
|
@ -3,6 +3,7 @@ module gitlab.com/whom/shs
|
||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/candid82/liner v1.4.0 // indirect
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
|
||||||
github.com/peterh/liner v1.2.0 // indirect
|
github.com/peterh/liner v1.2.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20200720211630-cb9d2d5c5666
|
golang.org/x/sys v0.0.0-20200720211630-cb9d2d5c5666
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -1,3 +1,5 @@
|
||||||
|
github.com/candid82/liner v1.4.0 h1:nUhs4pv/cnpnBERwJHmqmgargZTWnPbDJ67HtQcfSTo=
|
||||||
|
github.com/candid82/liner v1.4.0/go.mod h1:shD5EWTOYasmaGjMfuaB82N9YxGMIAEoXjQEH6RoGvo=
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||||
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
|
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ func waitHandler() {
|
||||||
exit = -1024
|
exit = -1024
|
||||||
var e *exec.ExitError
|
var e *exec.ExitError
|
||||||
if errors.As(w, &e) {
|
if errors.As(w, &e) {
|
||||||
exit = e.Pid()
|
exit = e.ExitCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
LastExitCode = exit
|
LastExitCode = exit
|
||||||
|
|
@ -156,7 +156,9 @@ func InitShellFeatures() bool {
|
||||||
func TeardownShell() {
|
func TeardownShell() {
|
||||||
close(sigChan)
|
close(sigChan)
|
||||||
close(waitChan)
|
close(waitChan)
|
||||||
// TODO: Exit all processes in the JobMap
|
for k := range JobMap {
|
||||||
|
JobMap[k].Cancel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Makes and stores a new process in the job control
|
/* Makes and stores a new process in the job control
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue