diff options
author | obscuren <geffobscura@gmail.com> | 2014-05-19 23:01:40 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-05-19 23:01:40 +0800 |
commit | 92eaa98e8381bef5224ffe864aa1cd4288af4d12 (patch) | |
tree | f8b488887a750d7ca6cd23278ae9cc2e737b7ddd /ethereum/ethereum.go | |
parent | 017bbbb582b09a3264b4ff996f35275d381f284f (diff) | |
download | go-tangerine-92eaa98e8381bef5224ffe864aa1cd4288af4d12.tar go-tangerine-92eaa98e8381bef5224ffe864aa1cd4288af4d12.tar.gz go-tangerine-92eaa98e8381bef5224ffe864aa1cd4288af4d12.tar.bz2 go-tangerine-92eaa98e8381bef5224ffe864aa1cd4288af4d12.tar.lz go-tangerine-92eaa98e8381bef5224ffe864aa1cd4288af4d12.tar.xz go-tangerine-92eaa98e8381bef5224ffe864aa1cd4288af4d12.tar.zst go-tangerine-92eaa98e8381bef5224ffe864aa1cd4288af4d12.zip |
Added js interpret mode
Diffstat (limited to 'ethereum/ethereum.go')
-rw-r--r-- | ethereum/ethereum.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 1cbb61002..f680b5416 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/go-ethereum/utils" + "io/ioutil" "log" "os" "os/signal" @@ -51,7 +52,7 @@ func main() { var logSys *log.Logger flags := log.LstdFlags - if StartJsConsole { + if StartJsConsole || len(InputFile) > 0 { ethutil.ReadConfig(DataDir, ethutil.LogFile) } else { ethutil.ReadConfig(DataDir, ethutil.LogFile|ethutil.LogStd) @@ -157,6 +158,22 @@ save these words so you can restore your account later: %s RegisterInterrupt(func(os.Signal) { repl.Stop() }) + } else if len(InputFile) > 0 { + file, err := os.Open(InputFile) + if err != nil { + ethutil.Config.Log.Fatal(err) + } + + content, err := ioutil.ReadAll(file) + if err != nil { + ethutil.Config.Log.Fatal(err) + } + + re := NewJSRE(ethereum) + RegisterInterrupt(func(os.Signal) { + re.Stop() + }) + re.Run(string(content)) } if StartRpc { |