# Path: pybombs/pb_logging.py
# BOLD = str('\033[1m')
# TRACE = 1
# class ColoredConsoleHandler(logging.StreamHandler):
# class PBLogger(logging.getLoggerClass()):
#     def emit(self, record):
#     def __init__(self, *args, **kwargs):
#     def trace(self, *args, **kwargs):


import os
import re
import signal
import subprocess
import threading
    from Queue import Queue, Empty
    from queue import Queue, Empty  # Py3k
from pybombs.pb_logging import logger
from pybombs.pb_exception import PBException
    from pybombs.config_manager import config_manager
    from pybombs.utils import output_proc
        " Modify the command to run with elevated privileges. "
        if isinstance(elevate_pre_args, str):
            elevate_pre_args = [elevate_pre_args,]
        if len(elevate_pre_args[0].strip()) == 0:
            elevate_pre_args = []
        if kwargs.get('shell', False) and isinstance(args, str):
            args = ' '.join(elevate_pre_args) + args
        else:
            args = elevate_pre_args + args
        return args
    def pretty_print_cmd(args):
        " Return pretty-printed version of the command. "
        if isinstance(args, list):
            return ' '.join(args)
        else:
            return "{sh}{cmd}".format(
                sh="$ " if kwargs.get('shell', False) else "",
                cmd=args.strip()
            )
    _process_thread.result = 0
    extra_popen_args = {}
    use_oproc = False
    o_proc = kwargs.get('o_proc')
    if isinstance(o_proc, output_proc.OutputProcessor):
        use_oproc = True
        extra_popen_args = o_proc.extra_popen_args
    if kwargs.get('shell', False) and isinstance(args, list):
        args = ' '.join(args)
    if kwargs.get('elevate'):
        args = elevate_command(args, config_manager.get('elevate_pre_args'))

# Path: pybombs/pb_logging.py
# BOLD = str('\033[1m')
# TRACE = 1
# class ColoredConsoleHandler(logging.StreamHandler):
# class PBLogger(logging.getLoggerClass()):
#     def emit(self, record):
#     def __init__(self, *args, **kwargs):
#     def trace(self, *args, **kwargs):


# Path: pybombs/utils/subproc.py
import os
import re
import signal
import subprocess
import threading
    from Queue import Queue, Empty
    from queue import Queue, Empty  # Py3k
from pybombs.pb_logging import logger
from pybombs.pb_exception import PBException
    from pybombs.config_manager import config_manager
    from pybombs.utils import output_proc

        " Modify the command to run with elevated privileges. "
        if isinstance(elevate_pre_args, str):
            elevate_pre_args = [elevate_pre_args,]
        if len(elevate_pre_args[0].strip()) == 0:
            elevate_pre_args = []
        if kwargs.get('shell', False) and isinstance(args, str):
            args = ' '.join(elevate_pre_args) + args
        else:
            args = elevate_pre_args + args
        return args
    def pretty_print_cmd(args):
        " Return pretty-printed version of the command. "
        if isinstance(args, list):
            return ' '.join(args)
        else:
            return "{sh}{cmd}".format(
                sh="$ " if kwargs.get('shell', False) else "",
                cmd=args.strip()
            )
    _process_thread.result = 0
    extra_popen_args = {}
    use_oproc = False
    o_proc = kwargs.get('o_proc')
    if isinstance(o_proc, output_proc.OutputProcessor):
        use_oproc = True
        extra_popen_args = o_proc.extra_popen_args
    if kwargs.get('shell', False) and isinstance(args, list):
        args = ' '.join(args)
    if kwargs.get('elevate'):
        args = elevate_command(args, config_manager.get('elevate_pre_args'))

    log = logger.getChild("_process_thread()")