mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 15:12:20 +00:00 
			
		
		
		
	#71 Handle OSError more gratefully
				
					
				
			This commit is contained in:
		
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ from setuptools import setup, find_packages | ||||
|  | ||||
|  | ||||
| setup(name='thefuck', | ||||
|       version=1.19, | ||||
|       version=1.20, | ||||
|       description="Magnificent app which corrects your previous console command", | ||||
|       author='Vladimir Iakovlev', | ||||
|       author_email='nvbn.rm@gmail.com', | ||||
|   | ||||
| @@ -3,18 +3,18 @@ import os | ||||
| from pathlib import Path | ||||
|  | ||||
|  | ||||
| def _safe(path, method): | ||||
| def _safe(fn, fallback): | ||||
|     try: | ||||
|         return getattr(path, method)() | ||||
|         return fn() | ||||
|     except OSError: | ||||
|         return [] | ||||
|         return fallback | ||||
|  | ||||
|  | ||||
| def _get_all_bins(): | ||||
|     return [exe.name | ||||
|             for path in os.environ['PATH'].split(':') | ||||
|             for exe in _safe(Path(path), 'iterdir') | ||||
|             if not _safe(exe, 'is_dir')] | ||||
|             for exe in _safe(Path(path).iterdir, []) | ||||
|             if not _safe(exe.is_dir, True)] | ||||
|  | ||||
|  | ||||
| def match(command, settings): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user