1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

moved display's debug lock to cli as global

This commit is contained in:
Brian Coca 2016-04-08 13:07:46 -04:00
parent dd39f57ae7
commit 0eb2844cc6
2 changed files with 13 additions and 4 deletions

View file

@ -36,6 +36,10 @@ import os
import sys import sys
import traceback import traceback
# for debug
from multiprocessing import Lock
debug_lock = Lock()
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
from ansible.utils.display import Display from ansible.utils.display import Display
from ansible.utils.unicode import to_unicode from ansible.utils.unicode import to_unicode

View file

@ -31,23 +31,28 @@ import getpass
import errno import errno
from struct import unpack, pack from struct import unpack, pack
from termios import TIOCGWINSZ from termios import TIOCGWINSZ
from multiprocessing import Lock
from ansible import constants as C from ansible import constants as C
from ansible.errors import AnsibleError from ansible.errors import AnsibleError
from ansible.utils.color import stringc from ansible.utils.color import stringc
from ansible.utils.unicode import to_bytes, to_unicode from ansible.utils.unicode import to_bytes, to_unicode
try:
from __main__ import debug_lock
except ImportError:
# for those not using a CLI, though ...
# this might not work well after fork
from multiprocessing import Lock
debug_lock = Lock()
try: try:
# Python 2 # Python 2
input = raw_input input = raw_input
except NameError: except NameError:
# Python 3 # Python 3, we already have raw_input
pass pass
# These are module level as we currently fork and serialize the whole process and locks in the objects don't play well with that
debug_lock = Lock()
logger = None logger = None
#TODO: make this a logging callback instead #TODO: make this a logging callback instead