Skip to content

Exit MarkBind with nonzero exit code on fatal error#679

Merged
yamgent merged 1 commit into
MarkBind:masterfrom
Xenonym:error-nonzero-exit-code
Feb 10, 2019
Merged

Exit MarkBind with nonzero exit code on fatal error#679
yamgent merged 1 commit into
MarkBind:masterfrom
Xenonym:error-nonzero-exit-code

Conversation

@Xenonym

@Xenonym Xenonym commented Feb 7, 2019

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request? (put "X" next to an item, remove the rest)

• [X] Bug fix

Resolves #651.

What is the rationale for this request?
MarkBind should exit with a nonzero return code (eg. 1) to indicate an error condition. This is especially important for running MarkBind in an automated context where other programs or scripts are relying on the exit code of MarkBind to detect errors (eg. as part of a custom build script, or Travis CI automation).

What changes did you make? (Give an overview)
I created a common error handler handleError to both log an error and set process.exitCode = 1, ensuring that MarkBind exits with a nonzero exit code on error.

Testing instructions:

  1. Run a MarkBind command that will exit on an error (eg. markbind build on a directory without a site.json). MarkBind should exit with a nonzero exit code.
    • In Bash: echo $?
    • In PowerShell: $LASTEXITCODE

@yamgent yamgent left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yamgent

yamgent commented Feb 8, 2019

Copy link
Copy Markdown
Member

@Xenonym need you to resolve conflicts.

@Xenonym

Xenonym commented Feb 8, 2019

Copy link
Copy Markdown
Contributor Author

@yamgent merge conflicts resolved!

@yamgent yamgent added this to the v1.17.4 milestone Feb 10, 2019
@yamgent yamgent merged commit a79c470 into MarkBind:master Feb 10, 2019
@Xenonym Xenonym deleted the error-nonzero-exit-code branch February 10, 2019 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed MarkBind commands should exit with nonzero return code

2 participants