cli: fix liner not closing (spuriously opened) in noninteractive jsre

release/1.0.1
zelig 10 years ago
parent fd8d18ec28
commit 1c4c71dcff
  1. 4
      cmd/ethereum/js.go
  2. 4
      cmd/ethereum/main.go

@ -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…
Cancel
Save