1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-13 22:28:33 +00:00

#71 Not fail on os error

This commit is contained in:
nvbn 2015-04-21 08:30:48 +02:00
parent 273fc097bd
commit 478fa4cd09
2 changed files with 10 additions and 3 deletions

View File

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(name='thefuck',
version=1.18,
version=1.19,
description="Magnificent app which corrects your previous console command",
author='Vladimir Iakovlev',
author_email='nvbn.rm@gmail.com',

View File

@ -3,11 +3,18 @@ import os
from pathlib import Path
def _safe(path, method):
try:
return getattr(path, method)()
except OSError:
return []
def _get_all_bins():
return [exe.name
for path in os.environ['PATH'].split(':')
for exe in Path(path).iterdir()
if exe.is_file()]
for exe in _safe(Path(path), 'iterdir')
if not _safe(exe, 'is_dir')]
def match(command, settings):