aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/js.go21
-rw-r--r--cmd/geth/main.go4
2 files changed, 16 insertions, 9 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index c5b25fe98..c31deefdd 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -145,19 +145,15 @@ func apiWordCompleter(line string, pos int) (head string, completions []string,
return begin, completionWords, end
}
-func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive bool, f xeth.Frontend) *jsre {
+func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive bool) *jsre {
js := &jsre{ps1: "> "}
js.wait = make(chan *big.Int)
js.client = client
js.ds = docserver.New("/")
- if f == nil {
- f = js
- }
-
// update state in separare forever blocks
js.re = re.New(libPath)
- if err := js.apiBindings(f); err != nil {
+ if err := js.apiBindings(js); err != nil {
utils.Fatalf("Unable to initialize console - %v", err)
}
@@ -286,7 +282,7 @@ func (js *jsre) apiBindings(f xeth.Frontend) error {
utils.Fatalf("Unable to determine supported api's: %v", err)
}
- jeth := rpc.NewJeth(api.Merge(apiImpl...), js.re, js.client)
+ jeth := rpc.NewJeth(api.Merge(apiImpl...), js.re, js.client, f)
js.re.Set("jeth", struct{}{})
t, _ := js.re.Get("jeth")
jethObj := t.Object()
@@ -382,6 +378,11 @@ func (self *jsre) interactive() {
for {
line, err := self.Prompt(<-prompt)
if err != nil {
+ if err == liner.ErrPromptAborted { // ctrl-C
+ self.resetPrompt()
+ inputln <- ""
+ continue
+ }
return
}
inputln <- line
@@ -466,6 +467,12 @@ func (self *jsre) parseInput(code string) {
var indentCount = 0
var str = ""
+func (self *jsre) resetPrompt() {
+ indentCount = 0
+ str = ""
+ self.ps1 = "> "
+}
+
func (self *jsre) setIndent() {
open := strings.Count(str, "{")
open += strings.Count(str, "(")
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 0bdcddf50..2dc3c438f 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -48,7 +48,7 @@ import (
)
const (
- ClientIdentifier = "Geth "
+ ClientIdentifier = "Geth"
Version = "1.0.1"
VersionMajor = 1
VersionMinor = 0
@@ -414,7 +414,7 @@ func attach(ctx *cli.Context) {
ctx.GlobalString(utils.JSpathFlag.Name),
client,
true,
- nil)
+ )
if ctx.GlobalString(utils.ExecFlag.Name) != "" {
repl.batch(ctx.GlobalString(utils.ExecFlag.Name))