diff options
author | obscuren <geffobscura@gmail.com> | 2014-06-27 01:52:23 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-06-27 01:52:23 +0800 |
commit | 91bdf9e8012cb396f5fa08765190d76e758fb6a0 (patch) | |
tree | 2f2ee4a263377ecff2c9b2958f7d007a534280d0 /ethereum/cmd.go | |
parent | 8100903d922dbced4f03db18ff766f28bdd2f706 (diff) | |
parent | ae5ace16190d48bfe7a0364fdb0b51644518ec42 (diff) | |
download | dexon-91bdf9e8012cb396f5fa08765190d76e758fb6a0.tar dexon-91bdf9e8012cb396f5fa08765190d76e758fb6a0.tar.gz dexon-91bdf9e8012cb396f5fa08765190d76e758fb6a0.tar.bz2 dexon-91bdf9e8012cb396f5fa08765190d76e758fb6a0.tar.lz dexon-91bdf9e8012cb396f5fa08765190d76e758fb6a0.tar.xz dexon-91bdf9e8012cb396f5fa08765190d76e758fb6a0.tar.zst dexon-91bdf9e8012cb396f5fa08765190d76e758fb6a0.zip |
Merge branch 'ethersphere-feature/logging' into develop
Diffstat (limited to 'ethereum/cmd.go')
-rw-r--r-- | ethereum/cmd.go | 32 |
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)) +} |