1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-20 09:39:01 +00:00

not use codes

This commit is contained in:
lovedboy 2015-11-17 19:04:27 +08:00
parent 33daa3529f
commit 100226ee9c

View File

@ -4,7 +4,6 @@ implement `from_shell`, `to_shell`, `app_alias`, `put_to_history` and
""" """
from collections import defaultdict from collections import defaultdict
import codecs
from psutil import Process from psutil import Process
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from time import time from time import time
@ -49,8 +48,8 @@ class Generic(object):
"""Puts command script to shell history.""" """Puts command script to shell history."""
history_file_name = self._get_history_file_name() history_file_name = self._get_history_file_name()
if os.path.isfile(history_file_name): if os.path.isfile(history_file_name):
with codecs.open(history_file_name, 'a', encoding='utf8') as history: with open(history_file_name, 'a') as history:
history.write(self._get_history_line(command_script)) history.write(self._get_history_line(command_script).encode("utf-8"))
def _script_from_history(self, line): def _script_from_history(self, line):
"""Returns prepared history line. """Returns prepared history line.