Skip to content

Commit

Permalink
fix(cli): program execution fails without debug information (#28687)
Browse files Browse the repository at this point in the history
When executing the CDK app program fails, we don't print any useful debug information. This makes sense because we are passing all output from the program to the shell, expecting this would be enough to debug any faults. However the program might be faulty in a way that no (useful) output is printed. To help with this case print the failing command when `--debug` is enabled.

This might require a follow up with a better DX for the generic non debug case. For now this will improve the situation.

Related to #28637

----

*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 12, 2024
1 parent 68d9c8b commit 8fbd385
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/aws-cdk/lib/api/cxapp/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export async function execProgram(aws: SdkProvider, config: Configuration): Prom
if (code === 0) {
return ok();
} else {
debug('failed command:', commandAndArgs);
return fail(new Error(`Subprocess exited with error ${code}`));
}
});
Expand Down

0 comments on commit 8fbd385

Please sign in to comment.