-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
added support for $EDITOR not being an executable #227
Conversation
…eing an executable
neuron/src/app/Neuron/CLI/New.hs
Outdated
-- Show it first in case the editor launch fails | ||
showAction path | ||
executeFile editorExe True [path] Nothing | ||
executeFile "bash" True ["-c", editor ++ ' ' : path ] Nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this break if path
had whitespace in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does path not create escape characters? How was it working before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: I tested this with EDITOR=vim
and it simply hangs.
neuron/src/app/Neuron/CLI/New.hs
Outdated
@@ -45,11 +44,11 @@ newZettelFile NewCommand {..} = do | |||
case mzid of | |||
Left e -> die $ show e | |||
Right zid -> do | |||
path <- zettelPath zid | |||
(notesDir, filename) <- zettelPath zid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get rid of the zettelPath
function, and inline its body here.
it's kind of a hack, but in order to well support whatever they have as their $EDITOR you'll need to interpret shell faithfully, so it has to be a bit hacky. I wanted to use
sh
, but sh doesn't have the-c
option (I don't think it's posix). I suppose this could be improved by checking the shell environment variable and acting accordingly, but supporting shells that don't have the "-c" option seems impossible. I figured trying to support all shells was futile so I just passed it to bash because that covers 99.9% of cases. (if your $EDITOR is not bash compliant I'm curious what black magic you are doing)