Handle stderr when using edit or config command, fixes #164

This commit is contained in:
Max Leiter 2016-09-19 22:33:09 -07:00
parent c090ab065f
commit e6bf20de2f
2 changed files with 8 additions and 2 deletions

View file

@ -6,9 +6,12 @@ program
.command("config")
.description("Edit config: " + Helper.CONFIG_PATH)
.action(function() {
child.spawn(
var child_spawn = child.spawn(
process.env.EDITOR || "vi",
[Helper.CONFIG_PATH],
{stdio: "inherit"}
);
child_spawn.on("error", function() {
log.error("Unable to open " + Helper.CONFIG_PATH + ". $EDITOR is not set, and vi was not found.");
});
});

View file

@ -12,9 +12,12 @@ program
log.error("User '" + name + "' doesn't exist.");
return;
}
child.spawn(
var child_spawn = child.spawn(
process.env.EDITOR || "vi",
[Helper.getUserConfigPath(name)],
{stdio: "inherit"}
);
child_spawn.on("error", function() {
log.error("Unable to open " + Helper.getUserConfigPath(name) + ". $EDITOR is not set, and vi was not found.");
});
});