diff options
-rw-r--r-- | pexpect/popen_spawn.py | 3 | ||||
-rw-r--r-- | pexpect/utils.py | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/pexpect/popen_spawn.py b/pexpect/popen_spawn.py index 600ac92..c9d4738 100644 --- a/pexpect/popen_spawn.py +++ b/pexpect/popen_spawn.py @@ -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,7 +40,7 @@ class PopenSpawn(SpawnBase): kwargs['startupinfo'] = startupinfo kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP - if not isinstance(cmd, (list, tuple)): + if isinstance(cmd, string_types): cmd = shlex.split(cmd) self.proc = subprocess.Popen(cmd, **kwargs) diff --git a/pexpect/utils.py b/pexpect/utils.py index ae0fe9d..bafc280 100644 --- a/pexpect/utils.py +++ b/pexpect/utils.py @@ -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. |