From 6512b23b98de070f9b68fed4f1530f66dfea4b66 Mon Sep 17 00:00:00 2001 From: zelig Date: Wed, 22 Apr 2015 00:47:17 +0100 Subject: [PATCH] cli: fatal error if rpc could not be started --- cmd/geth/main.go | 4 +++- cmd/utils/flags.go | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index a155e0a332..083d1c88a8 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -354,7 +354,9 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) { } // Start auxiliary services if enabled. if ctx.GlobalBool(utils.RPCEnabledFlag.Name) { - utils.StartRPC(eth, ctx) + if err := utils.StartRPC(eth, ctx); err != nil { + utils.Fatalf("Error starting RPC: %v", err) + } } if ctx.GlobalBool(utils.MiningEnabledFlag.Name) { eth.StartMining() diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 78d9c7afde..53e2694c59 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -330,7 +330,7 @@ func GetAccountManager(ctx *cli.Context) *accounts.Manager { return accounts.NewManager(ks) } -func StartRPC(eth *eth.Ethereum, ctx *cli.Context) { +func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error { config := rpc.RpcConfig{ ListenAddress: ctx.GlobalString(RPCListenAddrFlag.Name), ListenPort: uint(ctx.GlobalInt(RPCPortFlag.Name)), @@ -338,7 +338,7 @@ func StartRPC(eth *eth.Ethereum, ctx *cli.Context) { } xeth := xeth.New(eth, nil) - _ = rpc.Start(xeth, config) + return rpc.Start(xeth, config) } func StartPProf(ctx *cli.Context) {