Skip to content

Commit 932d001

Browse files
Japneet Singh ChawlaJapneet Singh Chawla
authored andcommitted
exit code changes
1 parent f8d17bc commit 932d001

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

commands/run.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ module.exports = function (args) {
7373
.then((status) => {
7474
batch_runner
7575
.run_batches(lt_config, batches, env)
76-
.then(function () {
76+
.then(function (exit_code) {
7777
console.log("stopping tunnel");
7878
tunnelInstance.stop();
79+
process.exit(exit_code);
7980
})
8081
.catch(function (error) {
8182
console.log("stopping tunnel failed");
@@ -89,7 +90,14 @@ module.exports = function (args) {
8990
);
9091
});
9192
} else {
92-
batch_runner.run_batches(lt_config, batches, env);
93+
batch_runner
94+
.run_batches(lt_config, batches, env)
95+
.then(function (exit_code) {
96+
process.exit(exit_code);
97+
})
98+
.catch(function (error) {
99+
process.exit(1);
100+
});
93101
}
94102
})
95103
.catch(function (err) {

commands/utils/batch/batch_runner.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ async function run(lt_config, batches, env, i = 0) {
115115
console.log("Waiting for build to finish...");
116116
poller
117117
.poll_build(lt_config, session_id, env)
118-
.then(function () {
119-
resolve();
118+
.then(function (exit_code) {
119+
resolve(exit_code);
120120
})
121121
.catch(function (err) {
122122
console.log();
123123
});
124124
} else {
125-
resolve();
125+
resolve(0);
126126
}
127127
})
128128
.catch(function (err) {

commands/utils/poller/poller.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ function poll_build(lt_config, session_id, env) {
3030
} else [(stats[build_info["data"][i]["status_ind"]] = 1)];
3131
}
3232
console.log(stats);
33-
resolve();
33+
if (
34+
Object.keys(stats).length == 1 &&
35+
Object.keys(stats).includes("completed")
36+
) {
37+
resolve(0);
38+
} else {
39+
resolve(1);
40+
}
3441
});
3542
} else {
3643
console.log(err);
37-
resolve();
44+
resolve(1);
3845
}
3946
}
4047
);

0 commit comments

Comments
 (0)