Hi Pádraig,

On 5/13/24 2:32 PM, Pádraig Brady wrote:
> I've an 18 year old script template here that silences Ctrl-C spew:
> https://www.pixelbeat.org/talks/python/cli_skel.py

Ah, okay I think I understand this now. So basically the backtrace is
the default excepthook and your code skips running the excepthooks for
KeyboardIneterrupt and it's subclasses right? So a KeyboardInterrupt
would still enter the try block but skip the backtrace.

> You can see a more modern usage of that in crudini at:
> https://github.com/pixelb/crudini/blob/cbb3b85e/crudini.py#L1134
> Note that also handles a closed stdin (and stdout elsewhere in that util).

Interesting. Nice work. I see you dealt with the Python 2
compatability stuff in 'file_is_closed'. :)

Thanks for the idea. I'll have a look at adding it to gnulib-tool
later today or tomorrow.

Collin

Reply via email to