Skip to content

Commit

Permalink
fix(cli): running the cli with --debug does not print stack traces (#…
Browse files Browse the repository at this point in the history
…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*
  • Loading branch information
mrgrain authored Jan 11, 2024
1 parent b9f4923 commit dd04725
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/aws-cdk/lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,17 @@ if (!process.stdout.isTTY) {
export async function exec(args: string[], synthesizer?: Synthesizer): Promise<number | void> {
const argv = await parseCommandLineArguments(args);

if (argv.verbose) {
setLogLevel(argv.verbose);
}

if (argv.debug) {
enableSourceMapSupport();
}

if (argv.verbose) {
setLogLevel(argv.verbose);

if (argv.verbose > 2) {
enableTracing(true);
}
// Debug should always imply tracing
if (argv.debug || argv.verbose > 2) {
enableTracing(true);
}

if (argv.ci) {
Expand Down

0 comments on commit dd04725

Please sign in to comment.