From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [iproute PATCH v2 4/4] lib: Enable colored output only for TTYs Date: Wed, 15 Aug 2018 10:24:31 -0600 Message-ID: <06633975-40ae-f3d6-b5a9-8a947752e400@gmail.com> References: <20180815162127.21477-1-phil@nwl.cc> <20180815162127.21477-5-phil@nwl.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Till Maas To: Phil Sutter , Stephen Hemminger Return-path: Received: from mail-pf1-f194.google.com ([209.85.210.194]:34936 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729329AbeHOTRW (ORCPT ); Wed, 15 Aug 2018 15:17:22 -0400 Received: by mail-pf1-f194.google.com with SMTP id p12-v6so720848pfh.2 for ; Wed, 15 Aug 2018 09:24:34 -0700 (PDT) In-Reply-To: <20180815162127.21477-5-phil@nwl.cc> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 8/15/18 10:21 AM, Phil Sutter wrote: > Add an additional prerequisite to check_enable_color() to make sure > stdout actually points to an open TTY device. Otherwise calls like > > | ip -color a s >/tmp/foo > > will print color escape sequences into that file. Allow to override this > check by specifying '-color' flag more than once. > > Signed-off-by: Phil Sutter > --- > Changes since v1: > - Allow to override isatty() check by specifying '-color' flag more than > once. That adds overhead to my workflow where I almost always have to pipe the output of ip to a pager.