-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cdk diff should not exit with error code in case there is a diff #1440
Comments
The This is particularly helpful when trying to come up with tests that assert an app synthesizes to exactly what one expected. With respects to this behavior not being documented anywhere, you are correct that this should be mentioned. |
Submitted a PR to mention the exit behavior of |
The `cdk diff` command intentionally returns non-zero when a difference is found, similar to how the POSIX `diff` command behaves (returning 0 when no difference is found, 1 when some difference is found, and >1 when an error occurred). This behavior was however undocumented, possibly leading to user confusion. This change adds a note in `cdk --help` that mentions the exit code 1 will be used when a difference is found. Fixes #1440
When running cdk diff commandline, the exit code is 1 in case there is a diff. While this might be useful if you are aware of it, it is semantically wrong, because the diff command executed successfully. When you stumble upon it you immediately go and check what you did wrong. I also did not find this behaviour documented anywhere.
The text was updated successfully, but these errors were encountered: