1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-20 20:09:07 +00:00

#415: Prevent double sudo

This commit is contained in:
nvbn 2015-12-11 07:41:13 +08:00
parent b65a9a0a4f
commit c3b1ba7637
2 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,7 @@ def test_match(stderr, stdout):
def test_not_match():
assert not match(Command())
assert not match(Command(script='sudo ls', stderr='Permission denied'))
@pytest.mark.parametrize('before, after', [

View File

@ -21,6 +21,9 @@ patterns = ['permission denied',
def match(command):
if command.script_parts and command.script_parts[0] == 'sudo':
return False
for pattern in patterns:
if pattern.lower() in command.stderr.lower()\
or pattern.lower() in command.stdout.lower():