(aws-cdk): CLI diff prints the diff output into stderr (or stdout with --ci) together with log messages #31306
Labels
@aws-cdk/core
Related to core CDK functionality
bug
This issue is a bug.
p3
package/tools
Related to AWS CDK Tools or CLI
Describe the bug
I'd like to get just the diff output from
cdk diff
command. It appears that AWS CDK CLI seems to print both the diff and various log messages intostderr
. I've taken a look at some of the related issues: #7717, #1638, and #10417. Seems that no combination of--quiet
,--ci
, or--no-color
helps.The diff
stderr
always contains log messages like:Of course I can clean that myself, but I feel that this is a sort of a bug.
If I provide
--ci
option orCI=true
env var, then the log messages and diff both go tostdout
.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Log messages that are not relevant to diff output should go to
stderr
and only the relevant diff output should go tostdout
.Current Behavior
Currently
cdk diff
prints log messages tostderr
, including:Unless
--ci
orCI=true
passed, in which case all the output goes tostdout
.Reproduction Steps
cdk diff 2>output.log
output.log
which will contain debug messagsPossible Solution
I think it would be reasonable change to just forward log messages into
stderr
and the actual diff output tostdout
.Though this would require modifications to:
aws-cdk/packages/aws-cdk/lib/api/util/cloudformation.ts
Line 346 in f3bc16c
If a change to the existing default behaviour is not possible, then maybe some additional CLI option to control this?
Additional Information/Context
No response
CDK CLI Version
2.155.0 (build 34dcc5a)
Framework Version
No response
Node.js Version
v20.12.2
OS
macOS Sonoma 14.6.1
Language
TypeScript
Language Version
5.5.4
Other information
No response
The text was updated successfully, but these errors were encountered: