Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle stderr when using edit or config command #622

Merged
merged 1 commit into from
Sep 25, 2016
Merged

Handle stderr when using edit or config command #622

merged 1 commit into from
Sep 25, 2016

Conversation

MaxLeiter
Copy link
Member

@MaxLeiter MaxLeiter commented Sep 20, 2016

Fixes #164.

@astorije astorije added Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors. second review needed Meta: Do Not Merge This PR should not be merged. labels Sep 21, 2016
@astorije
Copy link
Member

Not blocking v2.0.0 release, do not merge until then.

@astorije astorije self-assigned this Sep 21, 2016
child.spawn(
process.env.EDITOR || "vi",
var child_spawn = child.spawn(
process.env.EDITOR || "vi" || "nano",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your || "nano" addition doesn't make much sense, as the vi fallback is for the EDITOR being undefined.

Copy link
Member Author

@MaxLeiter MaxLeiter Sep 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case vi isn't present, we should try nano. @astorije's idea

EDIT: I see; EDITOR is a variable in this case - vi won't be undefined in javascript. Fixing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed now

process.env.EDITOR || "vi",
[Helper.CONFIG_PATH],
{stdio: "inherit"}
);
child_spawn.on("error", function() {
log.error("$EDITOR is not set, and vi was not found.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I would do is print Helper.CONFIG_PATH here so that users can easily edit the file in their favourite editor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fingers crossed 👍

process.env.EDITOR || "vi",
[Helper.getUserConfigPath(name)],
{stdio: "inherit"}
);
child_spawn.on("error", function() {
log.error("Unable to open " + Helper.CONFIG_PATH + ". $EDITOR is not set, and vi was not found.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong path here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Helper.getUserConfigPath(name)

@xPaw xPaw added this to the Next Release milestone Sep 24, 2016
@xPaw xPaw self-assigned this Sep 24, 2016
@astorije astorije removed Meta: Do Not Merge This PR should not be merged. second review needed labels Sep 25, 2016
@astorije
Copy link
Member

@xPaw, against the idea of falling back to nano if vi isn't found? Not the vi || nano thing, sorry I missed that, but in general. It seems to me like most things that open an editor on Unix will default do nano if $EDITOR isn't set (like git). No strong opinion though, just poking around.

@xPaw
Copy link
Member

xPaw commented Sep 25, 2016

@astorije I don't know which editor is more commonly preinstalled, but I am fine with changing vi to nano for the fallback.

@astorije
Copy link
Member

I was actually suggesting both, but maybe a bad idea. I don't care which one really, as long as the default is sensible. Let's go with that for now, changing default editor would be a different PR anyway, sorry for shifting focus.

@astorije astorije merged commit e568452 into thelounge:master Sep 25, 2016
@astorije astorije changed the title Handle stderr when using edit or config command, fixes #164 Handle stderr when using edit or config command Sep 25, 2016
@MaxLeiter MaxLeiter deleted the graceful-editor-fail branch September 25, 2016 05:57
@astorije astorije modified the milestones: Next Release, 2.0.1 Sep 28, 2016
matburnham pushed a commit to matburnham/lounge that referenced this pull request Sep 6, 2017
Handle stderr when using edit or config command, fixes thelounge#164
@xPaw xPaw unassigned astorije and xPaw Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants