Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Aug 2009 20:34:15 GMT
From:      Ivan Radovanovic <rivanr@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/137647: ps output depends on terminals column width when piping or redirecting
Message-ID:  <200908102034.n7AKYFZi010687@www.freebsd.org>
Resent-Message-ID: <200908102040.n7AKe1aM074601@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         137647
>Category:       misc
>Synopsis:       ps output depends on terminals column width when piping or redirecting
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 10 20:40:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Ivan Radovanovic
>Release:        7.2
>Organization:
>Environment:
FreeBSD azdaja.softwarehood.com 7.2-STABLE FreeBSD 7.2-STABLE #0: Mon Aug  3 17:12:57 CEST 2009     rivan@azdaja.softwarehood.com:/usr/src/sys/i386/compile/Azdaja  i386
>Description:
ps command formats its output according to setting of terminal it is running on even when piped or redirected to a file. This can cause serious confusion when using it in combination with other commands (for example ps -axj | grep opera won't give any output regardless opera browser is running in the example in "how to repeat" section)

>How-To-Repeat:
open xterm, set its width to 40 columns, do
ps -axj > ps.txt
ps.txt will be 40 columns wide

>Fix:
use isatty or stat to determine if ps's output is terminal

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908102034.n7AKYFZi010687>