Skip to content

Commit

Permalink
nvbn#414: Initialize output before any colorama import
Browse files Browse the repository at this point in the history
  • Loading branch information
nvbn committed Dec 4, 2015
1 parent ffd6183 commit 639054a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions thefuck/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Initialize output before importing any module, that can use colorama.
from .system import init_output

init_output()

from argparse import ArgumentParser
from warnings import warn
from pprint import pformat
Expand All @@ -8,12 +13,10 @@
from .exceptions import EmptyCommand
from .utils import get_installation_info
from .ui import select_command
from .system import init_output


def fix_command():
"""Fixes previous command. Used when `thefuck` called without arguments."""
init_output()
settings.init()
with logs.debug_time('Total'):
logs.debug(u'Run with settings: {}'.format(pformat(settings)))
Expand Down Expand Up @@ -51,7 +54,6 @@ def how_to_configure_alias():
It'll be only visible when user type fuck and when alias isn't configured.
"""
init_output()
settings.init()
logs.how_to_configure_alias(shells.how_to_configure())

Expand Down
2 changes: 1 addition & 1 deletion thefuck/system/win32.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import sys
import msvcrt
import colorama
import win_unicode_console
from .. import const


def init_output():
import colorama
win_unicode_console.enable()
colorama.init()

Expand Down

0 comments on commit 639054a

Please sign in to comment.