Skip to content

Commit 82cf4f9

Browse files
authored
Merge pull request #344 from parthlambdatest/Dot-6140
[Dot-6140] initial commit for exit code throwing at end of cli process
2 parents 7e36258 + 1e22618 commit 82cf4f9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "4.1.27",
3+
"version": "4.1.28",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/tasks/exec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
3939
if (code !== null) {
4040
task.title = `Execution of '${ctx.args.execCommand?.join(' ')}' completed; exited with code ${code}`;
4141
if (code !== 0) {
42-
reject();
4342
process.exitCode = code
4443
}
4544
} else if (signal !== null) {

src/tasks/finalizeBuild.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
4949
} else {
5050
is_baseline = false;
5151
}
52-
console.log(`start polling was called at finalize build for buildId: ${buildId}`)
5352
startPolling(ctx, buildId, is_baseline, capabilities.projectToken);
5453
await new Promise(resolve => setTimeout(resolve, 7000));
5554
ctx.fetchResultsForBuild.push(buildId);
@@ -87,6 +86,12 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
8786
let resp = ctx.client.sendCliLogsToLSRS(ctx);
8887
}
8988
}
89+
if (process.exitCode && process.exitCode !== 0) {
90+
ctx.log.error(`Exiting process with code ${process.exitCode}`);
91+
task.output = chalk.gray(`Exiting process with code ${process.exitCode}`);
92+
task.title = 'Build finalized with errors';
93+
throw new Error(`Process exited with code ${process.exitCode}`);
94+
}
9095
} catch (error: any) {
9196
ctx.log.debug(error);
9297
}

0 commit comments

Comments
 (0)