mirror of https://github.com/status-im/op-geth.git
cli: fix liner not closing (spuriously opened) in noninteractive jsre
This commit is contained in:
parent
fd8d18ec28
commit
1c4c71dcff
|
@ -67,14 +67,14 @@ type jsre struct {
|
|||
prompter
|
||||
}
|
||||
|
||||
func newJSRE(ethereum *eth.Ethereum, libPath string) *jsre {
|
||||
func newJSRE(ethereum *eth.Ethereum, libPath string, interactive bool) *jsre {
|
||||
js := &jsre{ethereum: ethereum, ps1: "> "}
|
||||
js.xeth = xeth.New(ethereum, js)
|
||||
js.re = re.New(libPath)
|
||||
js.apiBindings()
|
||||
js.adminBindings()
|
||||
|
||||
if !liner.TerminalSupported() {
|
||||
if !liner.TerminalSupported() || !interactive {
|
||||
js.prompter = dumbterm{bufio.NewReader(os.Stdin)}
|
||||
} else {
|
||||
lr := liner.NewLiner()
|
||||
|
|
|
@ -246,7 +246,7 @@ func console(ctx *cli.Context) {
|
|||
}
|
||||
|
||||
startEth(ctx, ethereum)
|
||||
repl := newJSRE(ethereum, ctx.String(utils.JSpathFlag.Name))
|
||||
repl := newJSRE(ethereum, ctx.String(utils.JSpathFlag.Name), true)
|
||||
repl.interactive()
|
||||
|
||||
ethereum.Stop()
|
||||
|
@ -261,7 +261,7 @@ func execJSFiles(ctx *cli.Context) {
|
|||
}
|
||||
|
||||
startEth(ctx, ethereum)
|
||||
repl := newJSRE(ethereum, ctx.String(utils.JSpathFlag.Name))
|
||||
repl := newJSRE(ethereum, ctx.String(utils.JSpathFlag.Name), false)
|
||||
for _, file := range ctx.Args() {
|
||||
repl.exec(file)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue