From b61c7c9406998673e89d45e68568700978a9ff27 Mon Sep 17 00:00:00 2001 From: Romain Marcadier-Muller Date: Mon, 7 Jan 2019 10:23:54 +0100 Subject: [PATCH] chore: Document return behavior of cdk diff (#1446) 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 --- packages/aws-cdk/bin/cdk.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk/bin/cdk.ts b/packages/aws-cdk/bin/cdk.ts index e505d6c6ef9d5..bd3bd03c316f4 100644 --- a/packages/aws-cdk/bin/cdk.ts +++ b/packages/aws-cdk/bin/cdk.ts @@ -59,7 +59,7 @@ async function parseCommandLineArguments() { .option('require-approval', { type: 'string', choices: [RequireApproval.Never, RequireApproval.AnyChange, RequireApproval.Broadening], desc: 'what security-sensitive changes need manual approval' })) .command('destroy [STACKS..]', 'Destroy the stack(s) named STACKS', yargs => yargs .option('force', { type: 'boolean', alias: 'f', desc: 'Do not ask for confirmation before destroying the stacks' })) - .command('diff [STACK]', 'Compares the specified stack with the deployed stack or a local template file', yargs => yargs + .command('diff [STACK]', 'Compares the specified stack with the deployed stack or a local template file, and returns with status 1 if any difference is found', yargs => yargs .option('template', { type: 'string', desc: 'the path to the CloudFormation template to compare with' }) .option('strict', { type: 'boolean', desc: 'do not filter out AWS::CDK::Metadata resources', default: false })) .command('metadata [STACK]', 'Returns all metadata associated with this stack')