1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-21 20:38:54 +00:00

#428: Don't fail when history is readonly

This commit is contained in:
nvbn 2016-01-13 22:00:20 +03:00
parent 8b05f6d46f
commit d53240b777

View File

@ -10,13 +10,14 @@ from time import time
import io
import os
import shlex
import sys
import six
from .utils import DEVNULL, memoize, cache
from .conf import settings
from . import logs
class Generic(object):
def get_aliases(self):
return {}
@ -69,7 +70,7 @@ class Generic(object):
lines = lines[-settings.history_limit:]
for line in lines:
prepared = self._script_from_history(line)\
prepared = self._script_from_history(line) \
.strip()
if prepared:
yield prepared
@ -139,7 +140,6 @@ class Bash(Generic):
class Fish(Generic):
def _get_overridden_aliases(self):
overridden_aliases = os.environ.get('TF_OVERRIDDEN_ALIASES', '').strip()
if overridden_aliases:
@ -303,7 +303,10 @@ def thefuck_alias():
def put_to_history(command):
try:
return _get_shell().put_to_history(command)
except IOError:
logs.exception("Can't update history", sys.exc_info())
def and_(*commands):