summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Slenders <jonathan@slenders.be>2017-02-13 21:45:41 +0100
committerJonathan Slenders <jonathan@slenders.be>2017-02-13 21:45:41 +0100
commit4a27a142de525bb5a84edfb7df0bfa673ef9847e (patch)
tree065c1a2a69a1203bc398ede2c9bc04d717b34b82
parent34c28fc63e44ddcaf6b215d5604b5081fa7290d4 (diff)
Use shlex.split() when calling the subprocess.
-rw-r--r--prompt_toolkit/buffer.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/prompt_toolkit/buffer.py b/prompt_toolkit/buffer.py
index e4ad00b0..92bab8f9 100644
--- a/prompt_toolkit/buffer.py
+++ b/prompt_toolkit/buffer.py
@@ -21,6 +21,7 @@ from six.moves import range
import os
import re
+import shlex
import six
import subprocess
import tempfile
@@ -1316,7 +1317,9 @@ class Buffer(object):
for e in editors:
if e:
try:
- returncode = subprocess.call(e.split(' ') + [filename])
+ # Use 'shlex.split()', because $VISUAL can contain spaces
+ # and quotes.
+ returncode = subprocess.call(shlex.split(e) + [filename])
return returncode == 0
except OSError: