From 8fbd385cb1cac8f309554d15bed738ea756b1b09 Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Fri, 12 Jan 2024 14:24:55 +0000 Subject: [PATCH] fix(cli): program execution fails without debug information (#28687) 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 https://github.com/aws/aws-cdk/issues/28637 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/cxapp/exec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/aws-cdk/lib/api/cxapp/exec.ts b/packages/aws-cdk/lib/api/cxapp/exec.ts index 757e03653d0e0..4069d7a660143 100644 --- a/packages/aws-cdk/lib/api/cxapp/exec.ts +++ b/packages/aws-cdk/lib/api/cxapp/exec.ts @@ -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}`)); } });