diff options
Diffstat (limited to 'jsre/jsre.go')
-rw-r--r-- | jsre/jsre.go | 9 |
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 } |