From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754688AbcGEHWN (ORCPT ); Tue, 5 Jul 2016 03:22:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:31940 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751354AbcGEHWM (ORCPT ); Tue, 5 Jul 2016 03:22:12 -0400 X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: andrew.donnellan@au1.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Subject: Re: checkkconfigsymbols.py: add --no-color option To: Josh Triplett References: <1467621570-970-1-git-send-email-andrew.donnellan@au1.ibm.com> <20160704122415.GA7267@x> Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, valentinrothberg@gmail.com From: Andrew Donnellan Date: Tue, 5 Jul 2016 17:22:05 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160704122415.GA7267@x> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070507-1617-0000-0000-00000135EDB5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070507-1618-0000-0000-00004635DB7F Message-Id: <8ab63bee-b025-427d-b4db-b71e729aa36d@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-05_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=1 spamscore=1 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607050067 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/07/16 22:24, Josh Triplett wrote: > Rather than requiring an explicit option, how about detecting > whether stdout is a TTY and automatically suppressing color? > You could check "os.isatty(1)" in main(), and set a global "color = > False". That would automatically handle the cases of redirecting to a > file or piping to another script, without requiring the user to pass > --no-color. That's a good point - I'll submit a v2 with that. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnellan@au1.ibm.com IBM Australia Limited