[PATCH 06/10] perf report: Setup browser if stdout is a pipe

From: Robert Richter
Date: Tue Dec 06 2011 - 05:33:06 EST


The decision to setup the browser should be made if stdout is pipe,
not stdin.

Signed-off-by: Robert Richter <robert.richter@xxxxxxx>
---
tools/perf/builtin-report.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 4d7c834..88ca2d4 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -504,6 +504,8 @@ static const struct option options[] = {

int cmd_report(int argc, const char **argv, const char *prefix __used)
{
+ struct stat st;
+
argc = parse_options(argc, argv, options, report_usage, 0);

if (use_stdio)
@@ -514,10 +516,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
if (inverted_callchain)
callchain_param.order = ORDER_CALLER;

- if (strcmp(input_name, "-") != 0)
- setup_browser(true);
- else
+ if (!fstat(STDOUT_FILENO, &st) && S_ISFIFO(st.st_mode))
use_browser = 0;
+ else
+ setup_browser(true);
+
/*
* Only in the newt browser we are doing integrated annotation,
* so don't allocate extra space that won't be used in the stdio
--
1.7.7


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/