Re: [Boost-bugs] [Boost C++ Libraries] #4590: Flushing a filtering_ostream stopped working in Boost 1.44

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4590: Flushing a filtering_ostream stopped working in Boost 1.44
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-09-08 19:53:03


#4590: Flushing a filtering_ostream stopped working in Boost 1.44
-------------------------------+--------------------------------------------
  Reporter: t0rt1e@… | Owner: turkanis
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: iostreams
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+--------------------------------------------
Changes (by duncanphilipnorman@…):

 * cc: duncanphilipnorman@… (added)

Comment:

 I've attached
 [attachment:boost_iostreams_filtering_ostream_does_not_flush_at_all.cpp],
 which demonstrates (on Linux) that even `std::cout` does not get flushed
 by `filtering_ostream`.

 I'm using:
  * GCC 4.3.4
  * Gentoo Linux
  * Boost 1.43.0

 I'm not sure if this is the same problem, but
 [http://groups.google.com/group/boost-
 list/browse_thread/thread/cc0f99ebade55cf3/ba8f563ea1f2f9fa?show_docid=ba8f563ea1f2f9fa
 my post to the mailing list] got no response.
  1. The basic recipe:
  {{{
 #!cpp
 filtering_ostream out;
 out.push(any_filter_at_all());
 out.push(std::cout);
 out << "Hello World!" << std::flush;
 sleep(10); // Observe an empty console.
 std::cout << std::flush;
 sleep(10); // Observe printed text on console.
 }}}
  1. This problem is quite bad for me when doing the following on the
 command-line (for a more complicated program):
  {{{
 #!sh
  ./program 2>&1 | tee some-file.log
 }}}
  Because stdout is not getting flushed, the stdout and stderr get
 intermingled strangely.
  1. However, disabling buffering on stdout works around the problem:
  {{{
 #!sh
  stdbuf --output=0 ./program 2>&1 | tee some-file.log
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4590#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC