libs/os: remove arbitrary os.Exit (#7284)

I think calling os.Exit at arbitrary points is _bad_ and is good to
delete. I think panics in the case of data courruption have a chance
of providing useful information.
This commit is contained in:
Sam Kleinman
2021-11-15 14:25:29 -05:00
committed by GitHub
parent a15ae5b53a
commit 2a455be46c
4 changed files with 22 additions and 26 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"fmt"
"net/http"
"os"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
@@ -35,10 +36,12 @@ func main() {
config := rpcserver.DefaultConfig()
listener, err := rpcserver.Listen("tcp://127.0.0.1:8008", config.MaxOpenConnections)
if err != nil {
tmos.Exit(err.Error())
logger.Error("rpc listening", "err", err)
os.Exit(1)
}
if err = rpcserver.Serve(listener, mux, logger, config); err != nil {
tmos.Exit(err.Error())
logger.Error("rpc serve", "err", err)
os.Exit(1)
}
}