diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-01 01:47:06 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-01 01:47:06 -0400 |
commit | 559a76ac2bb744fcef92fdc602bce7ba21cd52be (patch) | |
tree | 2298d9ae4a3e1b839f062c07dcd8e0ede2014652 /src/stream.cc | |
parent | 9d267fa1331a570e2b4c978f0b35a107a47b51c1 (diff) | |
download | fork-ledger-559a76ac2bb744fcef92fdc602bce7ba21cd52be.tar.gz fork-ledger-559a76ac2bb744fcef92fdc602bce7ba21cd52be.tar.bz2 fork-ledger-559a76ac2bb744fcef92fdc602bce7ba21cd52be.zip |
Fixed the way the pager process was being handled.
Diffstat (limited to 'src/stream.cc')
-rw-r--r-- | src/stream.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/stream.cc b/src/stream.cc index 3031f329..535a25a5 100644 --- a/src/stream.cc +++ b/src/stream.cc @@ -98,7 +98,7 @@ namespace { (char *)0); // We should never, ever reach here - perror("execl"); + perror((std::string("execl: ") + pager_path.string()).c_str()); exit(1); } else { // parent @@ -114,21 +114,22 @@ void output_stream_t::initialize(const optional<path>& output_file, { if (output_file) os = new ofstream(*output_file); - else if (pager_path && exists(*pager_path)) + else if (pager_path) pipe_to_pager_fd = do_fork(&os, *pager_path); else os = &std::cout; } -output_stream_t::~output_stream_t() +void output_stream_t::close() { - TRACE_DTOR(output_stream_t); - - if (os && os != &std::cout) + if (os != &std::cout) { checked_delete(os); + os = &std::cout; + } if (pipe_to_pager_fd != -1) { - close(pipe_to_pager_fd); + ::close(pipe_to_pager_fd); + pipe_to_pager_fd = -1; int status; wait(&status); |