Merge pull request #277 from mcarton/fix-sudo

Fix the pacman rule with `sudo`
This commit is contained in:
Vladimir Iakovlev
2015-07-07 16:30:02 +03:00
2 changed files with 23 additions and 11 deletions
+10 -1
View File
@@ -1,12 +1,21 @@
import subprocess
from thefuck.utils import DEVNULL, which
from thefuck import shells
from thefuck.utils import memoize
@memoize
def __get_pkgfile(command):
try:
command = command.script
if command.startswith('sudo'):
command = command[5:]
command = command.split(" ")[0]
return subprocess.check_output(
['pkgfile', '-b', '-v', command.script.split(" ")[0]],
['pkgfile', '-b', '-v', command],
universal_newlines=True, stderr=DEVNULL
).split()
except subprocess.CalledProcessError: