mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-21 10:08:59 +00:00
The byte sequence in command.script_parts[0] can contain one or more '\x00' which will cause os.stat(path) to throw this error: TypeError: must be encoded string without NULL bytes, not str
15 lines
342 B
Python
15 lines
342 B
Python
import os
|
|
from thefuck.specific.sudo import sudo_support
|
|
|
|
|
|
@sudo_support
|
|
def match(command):
|
|
return command.script_parts and os.path.exists(
|
|
command.script_parts[0].translate(None, '\x00')) \
|
|
and 'command not found' in command.stderr
|
|
|
|
|
|
@sudo_support
|
|
def get_new_command(command):
|
|
return u'./{}'.format(command.script)
|