Open edmorley opened 2 years ago
I was hoping to work around this by eg creating a bash alias to wrap the --wait
arg, however the edit-string
package doesn't use the shell
option with its execa
usage, so that doesn't work.
However, a workaround that does work is to create a script that wraps the call and put that on PATH
.
eg:
#!/usr/bin/env bash
exec code --wait "$@"
-> Ensure on path
-> export EDITOR='<script-name>.sh'
I'm running into the same issue, in addition to a different one:
heroku-cli doesn't appear honor the EDITOR env var that I've set in my .zshrc:
machty@MacBook-Pro business-server % echo $EDITOR
/usr/bin/vim
machty@MacBook-Pro business-server % heroku config:edit -r staging
Running ^ this opens pico, not vim.
All of the following DO work though:
EDITOR=vim heroku config:edit -r staging
EDITOR=/usr/bin/vim heroku config:edit -r staging
EDITOR=$EDITOR heroku config:edit -r staging
Added a work item to track the fix.
GUS Work Item (Heroku internal).
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
The
config:edit
help text says:This works if I set
EDITOR
(orVISUAL
) to a single command (such ascode
), however fails if I pass in additional arguments as per the final example in the help text.In VSCode's case, the argument
--wait
is required to make the editor wait for the window to be closed before the command returns (otherwise one gets a› Warning: no changes to config
warning from the Heroku CLI, as the command returned early).This is using macOS 12.3.1 with Homebrew bash.
What is the expected behavior?
That:
EDITOR
orVISUAL
set to values that include arguments to commands.This editor functionality is provided by the
edit-string
package, called here: https://github.com/heroku/cli/blob/b8292f347101f13c2bb833b1dcf088886c8aa984/packages/config/src/commands/config/edit.ts#L105Whose implementation is here: https://github.com/jdxcode/edit-string/blob/v1.1.6/src/edit.ts