summaryrefslogtreecommitdiff
path: root/src/cmdline
diff options
context:
space:
mode:
authorDaniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu>2010-06-10 09:28:54 -0700
committerDaniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu>2010-06-10 09:28:54 -0700
commit08d498b6d917b18500c18538e78cc528dcc82f9e (patch)
treedc03172d2d2c5c8686639ce9719c18aac7ec0839 /src/cmdline
parentb149639678fff9f8df74a68364df05083d3673d7 (diff)
downloadaptitude-08d498b6d917b18500c18538e78cc528dcc82f9e.tar.gz
Don't show any output from the transient message object if the output device isn't a terminal.
Diffstat (limited to 'src/cmdline')
-rw-r--r--src/cmdline/transient_message.cc16
-rw-r--r--src/cmdline/transient_message.h3
2 files changed, 18 insertions, 1 deletions
diff --git a/src/cmdline/transient_message.cc b/src/cmdline/transient_message.cc
index 6be506ee..0bac3211 100644
--- a/src/cmdline/transient_message.cc
+++ b/src/cmdline/transient_message.cc
@@ -46,6 +46,17 @@ namespace aptitude
namespace
{
+ /** \brief Transient message implementation that makes all
+ * methods into NOPs.
+ */
+ class dummy_transient_message : public transient_message
+ {
+ public:
+ void set_text(const std::wstring &msg)
+ {
+ }
+ };
+
class transient_message_impl : public transient_message
{
// The length of the last line we displayed. Not
@@ -140,7 +151,10 @@ namespace aptitude
create_transient_message(const shared_ptr<terminal> &term,
const shared_ptr<terminal_locale> &term_locale)
{
- return make_shared<transient_message_impl>(term, term_locale);
+ if(!term->output_is_a_terminal())
+ return make_shared<dummy_transient_message>();
+ else
+ return make_shared<transient_message_impl>(term, term_locale);
}
}
}
diff --git a/src/cmdline/transient_message.h b/src/cmdline/transient_message.h
index 4389106d..123333d0 100644
--- a/src/cmdline/transient_message.h
+++ b/src/cmdline/transient_message.h
@@ -48,6 +48,9 @@ namespace aptitude
/** \brief Create a new transient message object.
*
+ * If the given terminal is not a tty when this function is
+ * invoked, no output will be generated.
+ *
* \param term The terminal to use for output.
* \param term_locale Locale information for the given terminal.
*/