aboutsummaryrefslogtreecommitdiffstats
path: root/jsre
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-04-26 16:39:19 +0800
committerFelix Lange <fjl@twurst.com>2016-04-26 16:39:19 +0800
commit3d6d828caf2dbf2e7ceeeb6f0d38c3b654aefcd2 (patch)
treee2f449e08d17977cc47331f02c43a28a11e78f10 /jsre
parent70b8b54cd2413fb01e279890b2ddb5eb9bc227c2 (diff)
parent87ae0df476cf6b413795ee54207e8ec86e178dbc (diff)
downloadgo-tangerine-3d6d828caf2dbf2e7ceeeb6f0d38c3b654aefcd2.tar
go-tangerine-3d6d828caf2dbf2e7ceeeb6f0d38c3b654aefcd2.tar.gz
go-tangerine-3d6d828caf2dbf2e7ceeeb6f0d38c3b654aefcd2.tar.bz2
go-tangerine-3d6d828caf2dbf2e7ceeeb6f0d38c3b654aefcd2.tar.lz
go-tangerine-3d6d828caf2dbf2e7ceeeb6f0d38c3b654aefcd2.tar.xz
go-tangerine-3d6d828caf2dbf2e7ceeeb6f0d38c3b654aefcd2.tar.zst
go-tangerine-3d6d828caf2dbf2e7ceeeb6f0d38c3b654aefcd2.zip
Merge pull request #2478 from fjl/geth-js-tweak
cmd/geth, jsre: improve the js command
Diffstat (limited to 'jsre')
-rw-r--r--jsre/jsre.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/jsre/jsre.go b/jsre/jsre.go
index 7df022cb1..59730bc0d 100644
--- a/jsre/jsre.go
+++ b/jsre/jsre.go
@@ -235,7 +235,14 @@ func (self *JSRE) Exec(file string) error {
if err != nil {
return err
}
- self.Do(func(vm *otto.Otto) { _, err = vm.Run(code) })
+ var script *otto.Script
+ self.Do(func(vm *otto.Otto) {
+ script, err = vm.Compile(file, code)
+ if err != nil {
+ return
+ }
+ _, err = vm.Run(script)
+ })
return err
}