aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum/cmd.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-27 01:53:03 +0800
committerobscuren <geffobscura@gmail.com>2014-06-27 01:53:03 +0800
commitfd89df4d386f75f103808c2766c3a837e07ab651 (patch)
tree7b69cfda3c5dbc8431657ec34629c56bcdec0d8f /ethereum/cmd.go
parentb57ee874852cc49210c68dce14eb45db448d9ae7 (diff)
parent91bdf9e8012cb396f5fa08765190d76e758fb6a0 (diff)
downloaddexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.gz
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.bz2
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.lz
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.xz
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.zst
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.zip
Merge branch 'develop' into release/0.5.15
Diffstat (limited to 'ethereum/cmd.go')
-rw-r--r--ethereum/cmd.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/ethereum/cmd.go b/ethereum/cmd.go
new file mode 100644
index 000000000..08147824d
--- /dev/null
+++ b/ethereum/cmd.go
@@ -0,0 +1,32 @@
+package main
+
+import (
+ "github.com/ethereum/eth-go"
+ "github.com/ethereum/go-ethereum/utils"
+ "io/ioutil"
+ "os"
+)
+
+func InitJsConsole(ethereum *eth.Ethereum) {
+ repl := NewJSRepl(ethereum)
+ go repl.Start()
+ utils.RegisterInterrupt(func(os.Signal) {
+ repl.Stop()
+ })
+}
+
+func ExecJsFile(ethereum *eth.Ethereum, InputFile string) {
+ file, err := os.Open(InputFile)
+ if err != nil {
+ logger.Fatalln(err)
+ }
+ content, err := ioutil.ReadAll(file)
+ if err != nil {
+ logger.Fatalln(err)
+ }
+ re := NewJSRE(ethereum)
+ utils.RegisterInterrupt(func(os.Signal) {
+ re.Stop()
+ })
+ re.Run(string(content))
+}