From 04f9cdfd61d42f197e5cc339d51a183acf97996f Mon Sep 17 00:00:00 2001 From: Juanra GM Date: Wed, 10 Apr 2024 12:15:10 +0200 Subject: [PATCH] fix(cli): delay exit --- packages/cli/src/commands/RunCommand.ts | 4 ++-- packages/cli/src/utils/datatruck/job.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/commands/RunCommand.ts b/packages/cli/src/commands/RunCommand.ts index 9bfbd00..a7d3f87 100644 --- a/packages/cli/src/commands/RunCommand.ts +++ b/packages/cli/src/commands/RunCommand.ts @@ -39,11 +39,11 @@ export class RunCommand extends CommandAbstract { return { exitCode: 1 }; } - await runJob(job, jobName, { + const exitCode = await runJob(job, jobName, { verbose: verbose, configPath: config.path!, }); - return { exitCode: 0 }; + return { exitCode }; } } diff --git a/packages/cli/src/utils/datatruck/job.ts b/packages/cli/src/utils/datatruck/job.ts index 9afc88c..b95ac98 100644 --- a/packages/cli/src/utils/datatruck/job.ts +++ b/packages/cli/src/utils/datatruck/job.ts @@ -85,7 +85,7 @@ export async function runJob( const cliOptions = getJobCliOptions(job); const [node, bin] = process.argv; - const exitCode = await AsyncProcess.exec( + return await AsyncProcess.exec( node, [ process.env.DTT_BIN_SCRIPT ?? process.env.pm_exec_path ?? bin, @@ -103,8 +103,6 @@ export async function runJob( stdio: "inherit", }, ); - - process.exit(exitCode); } export async function runCronJob(job: Job, name: string, config: JobConfig) {