aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum/cmd.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-27 01:54:09 +0800
committerobscuren <geffobscura@gmail.com>2014-06-27 01:54:09 +0800
commit3777ead25e1acedc0571a48a485976eb5c36fb30 (patch)
tree38419590b42a20a51773e178acbbb3178ee89bf2 /ethereum/cmd.go
parentcba47963113d8041281278d75ee0dad046798e82 (diff)
parenta68bfd215f7b1859c1b14b0df59f3260b35df828 (diff)
downloadgo-tangerine-0.5.15.tar
go-tangerine-0.5.15.tar.gz
go-tangerine-0.5.15.tar.bz2
go-tangerine-0.5.15.tar.lz
go-tangerine-0.5.15.tar.xz
go-tangerine-0.5.15.tar.zst
go-tangerine-0.5.15.zip
Merge branch 'release/0.5.15'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))
+}