Merge pull request #622 from MaxLeiter/graceful-editor-fail
Handle stderr when using edit or config command, fixes #164
This commit is contained in:
commit
e568452528
@ -6,9 +6,12 @@ program
|
|||||||
.command("config")
|
.command("config")
|
||||||
.description("Edit config: " + Helper.CONFIG_PATH)
|
.description("Edit config: " + Helper.CONFIG_PATH)
|
||||||
.action(function() {
|
.action(function() {
|
||||||
child.spawn(
|
var child_spawn = child.spawn(
|
||||||
process.env.EDITOR || "vi",
|
process.env.EDITOR || "vi",
|
||||||
[Helper.CONFIG_PATH],
|
[Helper.CONFIG_PATH],
|
||||||
{stdio: "inherit"}
|
{stdio: "inherit"}
|
||||||
);
|
);
|
||||||
|
child_spawn.on("error", function() {
|
||||||
|
log.error("Unable to open " + Helper.CONFIG_PATH + ". $EDITOR is not set, and vi was not found.");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -12,9 +12,12 @@ program
|
|||||||
log.error("User '" + name + "' doesn't exist.");
|
log.error("User '" + name + "' doesn't exist.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
child.spawn(
|
var child_spawn = child.spawn(
|
||||||
process.env.EDITOR || "vi",
|
process.env.EDITOR || "vi",
|
||||||
[Helper.getUserConfigPath(name)],
|
[Helper.getUserConfigPath(name)],
|
||||||
{stdio: "inherit"}
|
{stdio: "inherit"}
|
||||||
);
|
);
|
||||||
|
child_spawn.on("error", function() {
|
||||||
|
log.error("Unable to open " + Helper.getUserConfigPath(name) + ". $EDITOR is not set, and vi was not found.");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user