mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-28 15:58:40 +00:00
#N/A: Use shutil.which
when possible
This commit is contained in:
parent
28d078708b
commit
bbfd53d718
@ -46,7 +46,11 @@ memoize.disabled = False
|
|||||||
@memoize
|
@memoize
|
||||||
def which(program):
|
def which(program):
|
||||||
"""Returns `program` path or `None`."""
|
"""Returns `program` path or `None`."""
|
||||||
|
try:
|
||||||
|
from shutil import which
|
||||||
|
|
||||||
|
return which(program)
|
||||||
|
except ImportError:
|
||||||
def is_exe(fpath):
|
def is_exe(fpath):
|
||||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user