def _process_json(event, pager_command):

    json_output = json.dumps(event, sort_keys=True, indent=2)

    # Strip trailing whitespace
    json_output = re.sub(r'\s+$', '', json_output, 0, re.M)

    force_colors = False  # TODO(CD): Introduce a --colors flag

    if not sys.stdout.isatty():
        if force_colors:
            return _highlight_json(json_output)
        else:
            return json_output

    supports_colors = not util.is_windows_platform()

    pager_is_set = pager_command is not None

    should_highlight = force_colors or supports_colors and not pager_is_set

    if should_highlight:
        json_output = _highlight_json(json_output)

    return json_output
When C{sys.argv[0]} is not C{"trial"} no destination is added by
dataset/ETHPy150Open dcos/dcos-cli/dcos/emitting.py/_process_json--crossover with--dataset/ETHPy150Open ClusterHQ/eliot/eliot/tests/test_twisted.py/RedirectLogsForTrialTests.test_withoutTrialNoDestination