Skip to content

Commit 29a1339

Browse files
Japneet Singh ChawlaJapneet Singh Chawla
authored andcommitted
added exit on failure param
1 parent 932d001 commit 29a1339

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

commands/run.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ module.exports = function (args) {
7676
.then(function (exit_code) {
7777
console.log("stopping tunnel");
7878
tunnelInstance.stop();
79-
process.exit(exit_code);
79+
if (
80+
lt_config["run_settings"]["exit-on-failure"]
81+
) {
82+
process.exit(exit_code);
83+
}
8084
})
8185
.catch(function (error) {
8286
console.log("stopping tunnel failed");
@@ -93,10 +97,14 @@ module.exports = function (args) {
9397
batch_runner
9498
.run_batches(lt_config, batches, env)
9599
.then(function (exit_code) {
96-
process.exit(exit_code);
100+
if (lt_config["run_settings"]["exit-on-failure"]) {
101+
process.exit(exit_code);
102+
}
97103
})
98104
.catch(function (error) {
99-
process.exit(1);
105+
if (lt_config["run_settings"]["exit-on-failure"]) {
106+
process.exit(1);
107+
}
100108
});
101109
}
102110
})

commands/utils/set_args.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,13 @@ function sync_args_from_cmd(args) {
235235
}
236236
if ("sync" in args) {
237237
lt_config["run_settings"]["sync"] = true ? args["sync"] == "true" : false;
238+
if ("exit-on-failure" in args) {
239+
lt_config["run_settings"]["exit-on-failure"] = true;
240+
} else {
241+
lt_config["run_settings"]["exit-on-failure"] = false;
242+
}
238243
}
244+
239245
if ("autostart" in args) {
240246
lt_config["tunnel_settings"]["autostart"] = true
241247
? args["autostart"] == "true"

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ const argv = require("yargs")
9898
describe: "Capture Network logs",
9999
type: "string",
100100
})
101+
.option("eof", {
102+
alias: "exit-on-failure",
103+
describe: "Exit With Code 1 on failure",
104+
type: "string",
105+
})
101106
);
102107
},
103108
function (argv) {

0 commit comments

Comments
 (0)