From 5ffdbde0866b18047b7c3942607dbe3622a3554f Mon Sep 17 00:00:00 2001 From: Nye Liu Date: Fri, 9 Aug 2019 16:25:23 +0000 Subject: [PATCH] Partial fix for #1320 Send launch errors to stderr, not stdout --- cmd/harmony/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index ae24dda3f..dfcab1d40 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -173,7 +173,7 @@ func passphraseForBls() { } passphrase, err := utils.GetPassphraseFromSource(*blsPass) if err != nil { - fmt.Printf("error when reading passphrase file: %v\n", err) + fmt.Fprintf(os.Stderr, "ERROR when reading passphrase file: %v\n", err) os.Exit(100) } blsPassphrase = passphrase @@ -197,7 +197,7 @@ func setupInitialAccount() (isLeader bool) { } if initialAccount == nil { - fmt.Printf("cannot find your BLS key in the genesis/FN tables: %s\n", pubKey.SerializeToHexStr()) + fmt.Fprintf(os.Stderr, "ERROR cannot find your BLS key in the genesis/FN tables: %s\n", pubKey.SerializeToHexStr()) os.Exit(100) } @@ -209,7 +209,7 @@ func setupInitialAccount() (isLeader bool) { func setupConsensusKey(nodeConfig *nodeconfig.ConfigType) *bls.PublicKey { consensusPriKey, err := blsgen.LoadBlsKeyWithPassPhrase(*blsKeyFile, blsPassphrase) if err != nil { - fmt.Printf("error when loading bls key, err :%v\n", err) + fmt.Fprintf(os.Stderr, "ERROR when loading bls key, err :%v\n", err) os.Exit(100) } pubKey := consensusPriKey.GetPublicKey() @@ -280,7 +280,7 @@ func setupConsensusAndNode(nodeConfig *nodeconfig.ConfigType) *node.Node { } commitDelay, err := time.ParseDuration(*delayCommit) if err != nil || commitDelay < 0 { - _, _ = fmt.Fprintf(os.Stderr, "invalid commit delay %#v", *delayCommit) + _, _ = fmt.Fprintf(os.Stderr, "ERROR invalid commit delay %#v", *delayCommit) os.Exit(1) } currentConsensus.SetCommitDelay(commitDelay) @@ -388,7 +388,7 @@ func main() { devnetConfig, err := shardingconfig.NewInstance( uint32(*devnetNumShards), *devnetShardSize, *devnetHarmonySize, genesis.HarmonyAccounts, genesis.FoundationalNodeAccounts, nil) if err != nil { - _, _ = fmt.Fprintf(os.Stderr, "invalid devnet sharding config: %s", + _, _ = fmt.Fprintf(os.Stderr, "ERROR invalid devnet sharding config: %s", err) os.Exit(1) }