[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg -l needs wider package name output



On Mon, Apr 14, 2003 at 04:18:21AM +0100, Colin Watson wrote:
> On Sun, Apr 13, 2003 at 10:41:38PM -0400, Travis Crump wrote:
> 
> > Also, I don't completely understand why 'dpkg -l | less' counts as a 
> > subshell, but 'dpkg -l' doesn't.
> 
> That's not true. What's actually happening is that, if COLUMNS isn't
> set, dpkg looks at its stdout to see whether it's a terminal, and if it
> is it tries to automatically detect the terminal size. When you pipe
> dpkg's output to less stdout is not a terminal so the autodetection
> fails.
> 
> In my own code I prefer to look at stdin rather than stdout to avoid
> this issue.

Isn't that even worse? That way if you were redirecting into a file,
either directly or indirectly, you'd still have your program thinking
it was talking to a terminal, and possibly screwing up the output (by
setting output widths, colours etc).

I don't know what the best way is though - switches?

Richard



Reply to: