Also handle non-absolute paths being used for $EDITOR
This commit is contained in:
parent
50e7351c73
commit
88f25ccc76
@ -226,7 +226,18 @@ def setup_environment(opts, args):
|
||||
if 'EDITOR' not in os.environ:
|
||||
shell_env = read_shell_environment(opts)
|
||||
if 'EDITOR' in shell_env:
|
||||
os.environ['EDITOR'] = shell_env['EDITOR']
|
||||
editor = shell_env['EDITOR']
|
||||
if 'PATH' in shell_env:
|
||||
import shlex
|
||||
editor_cmd = shlex.split(editor)
|
||||
if not os.path.isabs(editor_cmd[0]):
|
||||
editor_cmd[0] = shutil.which(editor_cmd[0], path=shell_env['PATH'])
|
||||
if editor_cmd[0]:
|
||||
editor = ' '.join(map(shlex.quote, editor_cmd))
|
||||
else:
|
||||
editor = None
|
||||
if editor:
|
||||
os.environ['EDITOR'] = editor
|
||||
else:
|
||||
os.environ['EDITOR'] = opts.editor
|
||||
if args.listen_on:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user