RasmusLindroth / tut

TUI for Mastodon with vim inspired keys
https://tut.anv.nu
MIT License
449 stars 29 forks source link

Use /bin/sh to run editor #95

Closed jezcope closed 3 years ago

jezcope commented 3 years ago

Currently when the editor is started, the contents of $EDITOR are passed directly as the first argument to exec.Command: this works fine if $EDITOR is set to a path or the name of a program somewhere in $PATH, but according to man 7 environ, "Any string acceptable as a command_string operand to the sh -c command shall be valid" for $EDITOR. Instead of trying to exec $EDITOR directly, it should have the filename appended and be passed to sh -c.

As a concrete example, if I run EDITOR='emacsclient -t' tut and then try to compose a toot, it crashes with exec: "emacsclient -t": executable file not found in $PATH when I press e; expected behaviour would be to open an emacs terminal frame to edit the toot.

Otherwise, tut is great and I love it, thanks for the work you put into this!

RasmusLindroth commented 3 years ago

Great that you found the bug. It should work with the latest release :)