Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion blurb/blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import math
import os
import re
import shlex
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -893,8 +894,21 @@ def init_tmp_with_template():

init_tmp_with_template()

# We need to be clever about EDITOR.
# On the one hand, it might be a legitimate path to an
# executable containing spaces.
# On the other hand, it might be a partial command-line
# with options.
if shutil.which(editor):
args = [editor]
else:
args = list(shlex.split(editor))
if not shutil.which(args[0]):
sys.exit("Invalid GIT_EDITOR / EDITOR value: {}".format(editor))
args.append(tmp_path)

while True:
subprocess.run([editor, tmp_path])
subprocess.run(args)

failure = None
blurb = Blurbs()
Expand Down