FS#7294 - base/initscripts: Make isatty a little more useful.

Attached to Project: Arch Linux
Opened by Andrew Fyfe (space-m0nkey) - Monday, 28 May 2007, 20:11 GMT
Last edited by Dan McGee (toofishes) - Wednesday, 12 September 2007, 15:40 GMT
Task Type Feature Request
Category Packages: Current
Status Closed
Assigned To Tobias Powalowski (tpowa)
Dan McGee (toofishes)
Architecture All
Severity Low
Priority Normal
Reported Version 2007.05 Duke
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Attached is an extended version of isatty that lets you pass which tty you won't to check so you can check stdout and stderr.
   isatty.c (0.2 KiB)
This task depends upon

Closed by  Dan McGee (toofishes)
Wednesday, 12 September 2007, 15:40 GMT
Reason for closing:  Won't fix
Additional comments about closing:  isatty no longer necessary
Comment by Dan McGee (toofishes) - Wednesday, 30 May 2007, 20:51 GMT
I like this, and I found another bug today related to the initscripts when they source /etc/rc.d/functions, and other times. The terminal checked by stty is the stream on stdin, and sometimes this fails if it is not a stty (I noticed it while running some build stuff related to pacman). Here is what I am talking about, and some non-working code to fix it that is in the right direction:

if [ $(isatty 2) ]; then
STAT_COL=$[`stty size | awk 'BEGIN { RS=" " }; END { print $1 }'` - 13]
else
STAT_COL=$((80 - 13))
unset $USECOLOR
fi
Comment by Tobias Powalowski (tpowa) - Sunday, 24 June 2007, 09:29 GMT
dan do you want to take this bug?
Comment by Dan McGee (toofishes) - Tuesday, 26 June 2007, 20:56 GMT
Sure, I'll take a look at it.
Comment by Dan McGee (toofishes) - Wednesday, 15 August 2007, 04:07 GMT
See
http://archlinux.org/pipermail/arch-dev-public/2007-August/001436.html
for a hopeful fix. Suggestions here were incorporated, please give me feedback by trying out the package in testing.

Notice that I removed isatty entirely- the bash option -t seems to do everything we need.

Loading...