diff options
author | Justin Tobler <jtobler@gitlab.com> | 2022-08-16 01:35:54 +0300 |
---|---|---|
committer | Justin Tobler <jtobler@gitlab.com> | 2022-08-16 01:51:09 +0300 |
commit | 33d3865e74d1f4b83f478516612660440fdbb3d9 (patch) | |
tree | 8d173afc0ec1c19fffae20d8a3133000077ed6ca | |
parent | 4128e23ac5533b0f3548d4a627e8a3e19718be5f (diff) |
gitaly: Exit code 1 on errorjt-gitaly-exit-code
Currently in Gitaly when `run()` returns an error and exits the exit
code returned is always 0. On error the exit code should be 1 to reflect
that the process terminated due to an error. This change checks for
errors returned by `run()` and exits with the appropriate error code.
-rw-r--r-- | cmd/gitaly/main.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/gitaly/main.go b/cmd/gitaly/main.go index 0f04a2b5d..765d729ca 100644 --- a/cmd/gitaly/main.go +++ b/cmd/gitaly/main.go @@ -105,8 +105,13 @@ func main() { if err != nil { log.Fatal(err) } - log.WithError(run(cfg)).Error("shutting down") - log.Info("Gitaly stopped") + + if err := run(cfg); err != nil { + log.WithError(err).Error("Gitaly shutdown") + os.Exit(1) + } + + log.Info("Gitaly shutdown") } func configure(configPath string) (config.Cfg, error) { |