summaryrefslogtreecommitdiff
path: root/src/global.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-29 00:23:57 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-29 00:23:57 -0400
commit2b2ffb7787df634aee1681dac7be48e986d34337 (patch)
tree8e93df310b06f56892341f76d024de4ebe7d3881 /src/global.cc
parent52433e56e562976887325ce48a6271abb82a89aa (diff)
downloadfork-ledger-2b2ffb7787df634aee1681dac7be48e986d34337.tar.gz
fork-ledger-2b2ffb7787df634aee1681dac7be48e986d34337.tar.bz2
fork-ledger-2b2ffb7787df634aee1681dac7be48e986d34337.zip
If isatty is available, no colors/pager for non-ttys
Diffstat (limited to 'src/global.cc')
-rw-r--r--src/global.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/global.cc b/src/global.cc
index 19cab1c8..6c8cc547 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -418,8 +418,14 @@ void global_scope_t::normalize_report_options(const string& verb)
report_t& rep(report());
- if (! rep.HANDLED(no_color))
+#ifdef HAVE_ISATTY
+ if (! rep.HANDLED(no_color) && isatty(STDOUT_FILENO))
rep.HANDLER(color).on_only(string("?normalize"));
+ if (rep.HANDLED(color) && ! isatty(STDOUT_FILENO))
+ rep.HANDLER(color).off();
+ if (rep.HANDLED(pager_) && ! isatty(STDOUT_FILENO))
+ rep.HANDLER(pager_).off();
+#endif
// jww (2009-02-09): These globals are a hack, but hard to avoid.
item_t::use_effective_date = (rep.HANDLED(effective) &&