mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
#71 Not fail on os error
This commit is contained in:
parent
273fc097bd
commit
478fa4cd09
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
|
|
||||||
setup(name='thefuck',
|
setup(name='thefuck',
|
||||||
version=1.18,
|
version=1.19,
|
||||||
description="Magnificent app which corrects your previous console command",
|
description="Magnificent app which corrects your previous console command",
|
||||||
author='Vladimir Iakovlev',
|
author='Vladimir Iakovlev',
|
||||||
author_email='nvbn.rm@gmail.com',
|
author_email='nvbn.rm@gmail.com',
|
||||||
|
@ -3,11 +3,18 @@ import os
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def _safe(path, method):
|
||||||
|
try:
|
||||||
|
return getattr(path, method)()
|
||||||
|
except OSError:
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
def _get_all_bins():
|
def _get_all_bins():
|
||||||
return [exe.name
|
return [exe.name
|
||||||
for path in os.environ['PATH'].split(':')
|
for path in os.environ['PATH'].split(':')
|
||||||
for exe in Path(path).iterdir()
|
for exe in _safe(Path(path), 'iterdir')
|
||||||
if exe.is_file()]
|
if not _safe(exe, 'is_dir')]
|
||||||
|
|
||||||
|
|
||||||
def match(command, settings):
|
def match(command, settings):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user