From 173a4300b40653458614c9fdf73ed740289d7357 Mon Sep 17 00:00:00 2001 From: nvbn Date: Wed, 8 Apr 2015 19:16:15 +0200 Subject: [PATCH] Fix sudo after npm errors --- setup.py | 2 +- tests/rules/test_sudo.py | 1 + thefuck/rules/sudo.py | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index fb680ea7..1e40a3fc 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup(name='thefuck', - version=1.1, + version=1.2, description="Magnificent app which corrects your previous console command", author='Vladimir Iakovlev', author_email='nvbn.rm@gmail.com', diff --git a/tests/rules/test_sudo.py b/tests/rules/test_sudo.py index e9d90126..85ac3ffd 100644 --- a/tests/rules/test_sudo.py +++ b/tests/rules/test_sudo.py @@ -5,6 +5,7 @@ from thefuck.rules.sudo import match, get_new_command def test_match(): assert match(Command('', '', 'Permission denied')) assert match(Command('', '', 'permission denied')) + assert match(Command('', '', "npm ERR! Error: EACCES, unlink")) assert not match(Command('', '', '')) diff --git a/thefuck/rules/sudo.py b/thefuck/rules/sudo.py index 9989286e..7d93b8c9 100644 --- a/thefuck/rules/sudo.py +++ b/thefuck/rules/sudo.py @@ -1,5 +1,6 @@ def match(command): - return 'permission denied' in command.stderr.lower() + return ('permission denied' in command.stderr.lower() + or 'EACCES' in command.stderr) def get_new_command(command):