diff --git a/IPython/utils/_process_cli.py b/IPython/utils/_process_cli.py index 89a31c3..03b2ecc 100644 --- a/IPython/utils/_process_cli.py +++ b/IPython/utils/_process_cli.py @@ -22,14 +22,6 @@ import os from IPython.utils import py3compat from ._process_common import arg_split -def _find_cmd(cmd): - """Find the full path to a command using which.""" - paths = System.Environment.GetEnvironmentVariable("PATH").Split(os.pathsep) - for path in paths: - filename = os.path.join(path, cmd) - if System.IO.File.Exists(filename): - return py3compat.decode(filename) - raise OSError("command %r not found" % cmd) def system(cmd): """ diff --git a/IPython/utils/_process_posix.py b/IPython/utils/_process_posix.py index a9b0e21..5f6b1ab 100644 --- a/IPython/utils/_process_posix.py +++ b/IPython/utils/_process_posix.py @@ -31,14 +31,6 @@ from IPython.utils.encoding import DEFAULT_ENCODING # Function definitions #----------------------------------------------------------------------------- -def _find_cmd(cmd): - """Find the full path to a command using which.""" - - path = sp.Popen(['/usr/bin/env', 'which', cmd], - stdout=sp.PIPE, stderr=sp.PIPE).communicate()[0] - return py3compat.decode(path) - - class ProcessHandler(object): """Execute subprocesses under the control of pexpect. """ diff --git a/IPython/utils/_process_win32.py b/IPython/utils/_process_win32.py index 2f072a8..36fb092 100644 --- a/IPython/utils/_process_win32.py +++ b/IPython/utils/_process_win32.py @@ -71,27 +71,6 @@ class AvoidUNCPath(object): os.chdir(self.path) -def _find_cmd(cmd): - """Find the full path to a .bat or .exe using the win32api module.""" - try: - from win32api import SearchPath - except ImportError as e: - raise ImportError('you need to have pywin32 installed for this to work') from e - else: - PATH = os.environ['PATH'] - extensions = ['.exe', '.com', '.bat', '.py'] - path = None - for ext in extensions: - try: - path = SearchPath(PATH, cmd, ext)[0] - except: - pass - if path is None: - raise OSError("command %r not found" % cmd) - else: - return path - - def _system_body(p): """Callback for _system.""" enc = DEFAULT_ENCODING