Giuseppe Scrivano <[email protected]> writes:

> Jim Meyering <[email protected]> writes:
>
>> Great! Thank you.
>>
>>> but it will need a change in the code as well, since
>>> the signals are installed only when outputting to a tty:
>> ...
>>> -  if (output_is_tty)
>>> +  if (output_is_tty || getenv ("DIFF_INSTALL_SIGNALS"))
>>>      install_signal_handlers ();
>>
>> However, we try very hard to avoid making tools depend on
>> environment variable settings more than they already do,
>> so how about a hidden, three-hyphen option, say,
>> ---presume-output-tty, analogous to rm's ---presume-input-tty?
>
> I have added a test that uses the new option ---presume-output-tty.
>
> From 4aea918d31454fdeaada5e2453bea3dfc2e25f8b Mon Sep 17 00:00:00 2001
> From: Giuseppe Scrivano <[email protected]>
> Date: Mon, 1 Feb 2016 09:58:52 +0100
> Subject: [PATCH] Fix an infinite recursion with --color
>
> * src/diff.h: New extern variable `presume_output_tty'.
> * src/diff.c: New enum PRESUME_OUTPUT_TTY_OPTION.
> (group_format_option): Add '-presume-output-tty'.
> (main): Handle PRESUME_OUTPUT_TTY_OPTION.
> * src/util.c: New variable `presume_output_tty'.
> (check_color_output): Handle presume_output_tty.
> (set_color_context): Call process_signals only when color_context is
> not RESET_CONTEXT.
> * tests/colors: Check that diff doesn't crash when interrupted
> in the middle of a color sequence.
>
> Reported by Gisle Vanem in http://debbugs.gnu.org/22067
> ---

ping.

Regards,
Giuseppe



Reply via email to