Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Return an error code to the shell if an error occurs when running `platform server` #8189
Currently, if an error occurs when starting the server using
This means it is not possible to know whether the server started successfully or not. From the shell point of view, it started successfully and existed very quickly. Additionally, no error message is printed to the console.
$ rm config/config.json $ if bin/platform server; then echo "Success"; else echo "Failure"; fi Success # The server actually failed to launch, but there is no way to know it (besides a message in the log file)
With this change, the
This allow shell scripts to properly detect the startup failure, and to react to it.
$ rm config/config.json $ if bin/platform server; then echo "Success"; else echo "Failure"; fi Error: LoadConfig: Error decoding config file=config.json, err=While parsing config: invalid character ':' after top-level value, Failure # The server failed to launch, and it is possible to react to it in a script. # (The error message is still added to the log file, but also printed # on the console, as part of cobra's standard behavior.)
More importantly, in production, it allows the service launcher (like
Thanks @kemenaran for the pull request!
Please help complete the Mattermost contribution license agreement?
This is a standard procedure for many open source projects. Your form should be processed within 24 hours and reviewers for your pull request will be able to proceed.
Please let us know if you have any questions.
We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team.