Use correct exit codes when running Etcher CLI with --robot (#384)

Currently, the exit codes documented in the help section was not
honoured if the CLI was ran with the `--robot` option. In this case, the
CLI would exit with code 0 even if the validation failed.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
Juan Cruz Viotti 2016-04-29 12:30:09 -04:00
parent 087a008d0d
commit d52f948e46

View File

@ -78,14 +78,18 @@ form.run([
}).then(function(success) {
if (options.robot) {
return console.log(`done ${success}`);
console.log(`done ${success}`);
} else {
if (success) {
console.log('Your flash is complete!');
} else {
console.error('Validation failed!');
}
}
if (success) {
console.log('Your flash is complete!');
process.exit(EXIT_CODES.SUCCESS);
} else {
console.error('Validation failed!');
process.exit(EXIT_CODES.VALIDATION_ERROR);
}