Use shlex to parse editor commandline as per 2.0-rc1 (#556)

This commit is contained in:
hoclun-rigsep 2018-08-16 18:16:29 -04:00
parent 240fb883cc
commit 6826f07b6e

View file

@ -163,7 +163,10 @@ def get_text_from_editor(config, template=""):
with codecs.open(tmpfile, 'w', "utf-8") as f: with codecs.open(tmpfile, 'w', "utf-8") as f:
if template: if template:
f.write(template) f.write(template)
subprocess.call(shlex.split(config['editor'], posix="win" not in sys.platform) + [tmpfile]) try:
subprocess.call(shlex.split(config['editor'], posix="win" not in sys.platform) + [tmpfile])
except AttributeError:
subprocess.call(config['editor'] + [tmpfile])
with codecs.open(tmpfile, "r", "utf-8") as f: with codecs.open(tmpfile, "r", "utf-8") as f:
raw = f.read() raw = f.read()
os.close(filehandle) os.close(filehandle)