-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
If the last command contains a non-ASCII character, The Fuck crashes with a UnicodeEncodeError.
Such an error can easily happen on non-English keyboards, e.g. on my Hungarian keyboard, it's very easy to misspell 'ls" as "és", or "ps aux" as "ős aux".
Reproduction:
with The Fuck configured, run "ápt-get moo", then "fuck".
The following error appears:
Traceback (most recent call last):
File "/home/osboxes/venv/bin/thefuck", line 11, in
sys.exit(main())
File "/home/osboxes/venv/local/lib/python2.7/site-packages/thefuck/main.py", line 53, in main
fix_command(known_args)
File "/home/osboxes/venv/local/lib/python2.7/site-packages/thefuck/main.py", line 29, in fix_command
command = types.Command.from_raw_script(raw_command)
File "/home/osboxes/venv/local/lib/python2.7/site-packages/thefuck/types.py", line 76, in from_raw_script
stdout, stderr = get_output(script, expanded)
File "/home/osboxes/venv/local/lib/python2.7/site-packages/thefuck/output_readers/init.py", line 18, in get_output
return rerun.get_output(script, expanded)
File "/home/osboxes/venv/local/lib/python2.7/site-packages/thefuck/output_readers/rerun.py", line 42, in get_output
is_slow = shlex.split(expanded) in settings.slow_commands
File "/usr/lib/python2.7/shlex.py", line 275, in split
lex = shlex(s, posix=posix)
File "/usr/lib/python2.7/shlex.py", line 25, in init
instream = StringIO(instream)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 0: ordinal not in range(128)
If you instead type "opt-get moo", then "fuck", it works fine.