diff --git a/thefuck/utils.py b/thefuck/utils.py index 466e4ba51..6917ad26d 100644 --- a/thefuck/utils.py +++ b/thefuck/utils.py @@ -50,7 +50,6 @@ def which(program): """Returns `program` path or `None`.""" try: from shutil import which - return which(program) except ImportError: def is_exe(fpath): @@ -62,14 +61,18 @@ def is_exe(fpath): return program else: for path in os.environ["PATH"].split(os.pathsep): - path = path.strip('"') + # Strip only the whitespace by default + path = path.strip() + # Remove only the surrounding double quotes, if any + if path.startswith('"') and path.endswith('"'): + path = path[1:-1] exe_file = os.path.join(path, program) if is_exe(exe_file): return exe_file - return None + def default_settings(params): """Adds default values to settings if it not presented.