Re: Weird console bug

From: Justin Hibbits <jrh29_at_alumni.cwru.edu>
Date: Mon, 10 Aug 2009 16:15:21 -0400
On Mon, Aug 10, 2009 at 4:03 PM, Doug Barton<dougb_at_freebsd.org> wrote:
> Ivan Radovanovic wrote:
>> Poul-Henning Kamp wrote:
>>> In message <4A80778B.8090708_at_gmail.com>, Ivan Radovanovic writes:
>>>
>>>
>>>> ps -axj | grep opera
>>>> You will receive different results depending on width on console
>>>> window (for example, for me no results on normal text mode console,
>>>> in X it depends on width of console you are executing above command in).
>>>>
>>>
>>> See the -w option to ps
>>>
>>>
>>
>> Thanks, anyway I find this behavior weird when redirecting or piping...
>
> And how does ps know when it's being redirected or piped?
>
>
> Doug
>
> --
>
>    This .signature sanitized for your protection
>
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
>

ps could be modified to use isatty(3) to determine if stdout is a tty.
 Currently if any of the tty ioctls return -1 it assumes a failsafe of
79 column width.

This may not be necessary, though, since from the man page, specifying
'-w' multiple times will make it use as many columns as necessary.
Perhaps this could be the default if not a tty.

- Justin
Received on Mon Aug 10 2009 - 18:15:24 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:53 UTC