#132 Merge pip_install_sudo rule with sudo rule

This commit is contained in:
nvbn
2015-04-29 05:01:30 +02:00
parent 4be60c78fa
commit 99d9c9aff7
4 changed files with 10 additions and 78 deletions
-13
View File
@@ -1,13 +0,0 @@
import re
from thefuck.utils import sudo_support
def match(command, settings):
return (('pip' in command.script and 'install' in command.script) and
'failed with error code 1' in command.stderr and
('Errno 13' in command.stdout or
'Permission denied' in command.stdout))
def get_new_command(command, settings):
return u'sudo {}'.format(command.script)
+2 -1
View File
@@ -13,7 +13,8 @@ patterns = ['permission denied',
def match(command, settings):
for pattern in patterns:
if pattern.lower() in command.stderr.lower():
if pattern.lower() in command.stderr.lower()\
or pattern.lower() in command.stdout.lower():
return True
return False