Skip to content

Commit dd04725

Browse files
authored
fix(cli): running the cli with --debug does not print stack traces (#28669)
`--debug` exists for exactly one purpose: Printing source-mapped traces so we can find the code that is going wrong. Let's always enabled tracing when debugging. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b9f4923 commit dd04725

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/aws-cdk/lib/cli.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -315,16 +315,17 @@ if (!process.stdout.isTTY) {
315315
export async function exec(args: string[], synthesizer?: Synthesizer): Promise<number | void> {
316316
const argv = await parseCommandLineArguments(args);
317317

318+
if (argv.verbose) {
319+
setLogLevel(argv.verbose);
320+
}
321+
318322
if (argv.debug) {
319323
enableSourceMapSupport();
320324
}
321325

322-
if (argv.verbose) {
323-
setLogLevel(argv.verbose);
324-
325-
if (argv.verbose > 2) {
326-
enableTracing(true);
327-
}
326+
// Debug should always imply tracing
327+
if (argv.debug || argv.verbose > 2) {
328+
enableTracing(true);
328329
}
329330

330331
if (argv.ci) {

0 commit comments

Comments
 (0)