Merge pull request #752 from kennethreitz/update_pexcept

update vendored pexcept to fix shellquote issues on Windows
This commit is contained in:
2017-09-28 09:29:03 -04:00
committed by GitHub
4 changed files with 14 additions and 5 deletions
+2
View File
@@ -1,3 +1,5 @@
Unreleased:
- Update pexcept to fix shellquote issues in subprocesses.
8.1.4:
- Tell users in compatibility mode how to exit the shell.
- Updated patched pip's vendored pkg-resources.
+4 -2
View File
@@ -15,6 +15,7 @@ except ImportError:
from .spawnbase import SpawnBase, PY3
from .exceptions import EOF
from .utils import string_types
class PopenSpawn(SpawnBase):
if PY3:
@@ -39,10 +40,11 @@ class PopenSpawn(SpawnBase):
kwargs['startupinfo'] = startupinfo
kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP
if not isinstance(cmd, (list, tuple)):
cmd = shlex.split(cmd, posix=(os.name == 'posix'))
if isinstance(cmd, string_types) and sys.platform != 'win32':
cmd = shlex.split(cmd, posix=os.name == 'posix')
self.proc = subprocess.Popen(cmd, **kwargs)
self.pid = self.proc.pid
self.closed = False
self._buf = self.string_type()
+3 -3
View File
@@ -114,9 +114,9 @@ def bash(command="bash"):
# replwrap seeing that as the next prompt, we'll embed the marker characters
# for invisible characters in the prompt; these show up when inspecting the
# environment variable, but not when bash displays the prompt.
ps1 = PEXPECT_PROMPT[:5] + u'\[\]' + PEXPECT_PROMPT[5:]
ps2 = PEXPECT_CONTINUATION_PROMPT[:5] + u'\[\]' + PEXPECT_CONTINUATION_PROMPT[5:]
ps1 = PEXPECT_PROMPT[:5] + u'\\[\\]' + PEXPECT_PROMPT[5:]
ps2 = PEXPECT_CONTINUATION_PROMPT[:5] + u'\\[\\]' + PEXPECT_CONTINUATION_PROMPT[5:]
prompt_change = u"PS1='{0}' PS2='{1}' PROMPT_COMMAND=''".format(ps1, ps2)
return REPLWrapper(child, u'\$', prompt_change,
return REPLWrapper(child, u'\\$', prompt_change,
extra_init_cmd="export PAGER=cat")
+5
View File
@@ -11,6 +11,11 @@ except NameError:
# Alias Python2 exception to Python3
InterruptedError = select.error
if sys.version_info[0] >= 3:
string_types = (str,)
else:
string_types = (unicode, str)
def is_executable_file(path):
"""Checks that path is an executable regular file, or a symlink towards one.