aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cmd.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-26 23:26:14 +0800
committerzelig <viktor.tron@gmail.com>2014-06-26 23:26:14 +0800
commit21d86ca486a88c936a1fe71f78d76c78df36a7eb (patch)
tree03cf271f99fba4e537c4fe8e91fb8ce53b3e2072 /utils/cmd.go
parentc0a05fcf8984f04f198c5c0f8be4f73090f99403 (diff)
downloaddexon-21d86ca486a88c936a1fe71f78d76c78df36a7eb.tar
dexon-21d86ca486a88c936a1fe71f78d76c78df36a7eb.tar.gz
dexon-21d86ca486a88c936a1fe71f78d76c78df36a7eb.tar.bz2
dexon-21d86ca486a88c936a1fe71f78d76c78df36a7eb.tar.lz
dexon-21d86ca486a88c936a1fe71f78d76c78df36a7eb.tar.xz
dexon-21d86ca486a88c936a1fe71f78d76c78df36a7eb.tar.zst
dexon-21d86ca486a88c936a1fe71f78d76c78df36a7eb.zip
gui stop
- introduce gui.Stop() - remember state with open - stopping ethereum stack is not gui concern, moved to main - stopping mining, gui and ethereum handled via interrupt callbacks - ^C triggers exactly the same behaviour as quit via menu
Diffstat (limited to 'utils/cmd.go')
-rw-r--r--utils/cmd.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/utils/cmd.go b/utils/cmd.go
index da05c6d83..db5ec5b48 100644
--- a/utils/cmd.go
+++ b/utils/cmd.go
@@ -32,13 +32,17 @@ func HandleInterrupt() {
signal.Notify(c, os.Interrupt)
for sig := range c {
logger.Errorf("Shutting down (%v) ... \n", sig)
- for _, cb := range interruptCallbacks {
- cb(sig)
- }
+ RunInterruptCallbacks(sig)
}
}()
}
+func RunInterruptCallbacks(sig os.Signal) {
+ for _, cb := range interruptCallbacks {
+ cb(sig)
+ }
+}
+
func AbsolutePath(Datadir string, filename string) string {
if path.IsAbs(filename) {
return filename
@@ -94,6 +98,7 @@ func InitLogging (Datadir string, LogFile string, LogLevel int, DebugFile string
}
func InitConfig(ConfigFile string, Datadir string, Identifier string, EnvPrefix string) {
+ InitDataDir(Datadir)
ethutil.ReadConfig(ConfigFile, Datadir, Identifier, EnvPrefix)
ethutil.Config.Set("rpcport", "700")
}
@@ -120,8 +125,6 @@ func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) {
ethereum.Stop()
ethlog.Flush()
})
- // this blocks the thread
- ethereum.WaitForShutdown()
}
func ShowGenesis(ethereum *eth.Ethereum) {