Fix the pacman rule with sudo

Does not use @sudo_support as this does not place 'sudo' at the right
position.
This commit is contained in:
mcarton
2015-06-28 22:10:34 +02:00
parent cb33c912e5
commit 51b5dd0460
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: