aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/process.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-19 19:03:51 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-21 14:58:16 +0100
commit322fc9a9acd2cfed2c3b7c70ee022e34fc1fd1f7 (patch)
treee9f6943b1c3f007e2c70cea75336a6278f0e5ef4 /paludis/util/process.cc
parent1bb84c09850dcf2136bc9134ead3409a3ccaf547 (diff)
downloadpaludis-322fc9a9acd2cfed2c3b7c70ee022e34fc1fd1f7.tar.gz
paludis-322fc9a9acd2cfed2c3b7c70ee022e34fc1fd1f7.tar.xz
Process::use_ptys
Diffstat (limited to 'paludis/util/process.cc')
-rw-r--r--paludis/util/process.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/paludis/util/process.cc b/paludis/util/process.cc
index 0da85b0..f93eeb8 100644
--- a/paludis/util/process.cc
+++ b/paludis/util/process.cc
@@ -21,6 +21,7 @@
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/thread.hh>
#include <paludis/util/pipe.hh>
+#include <paludis/util/pty.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/stringify.hh>
@@ -100,10 +101,10 @@ namespace paludis
Pipe ctl_pipe;
std::ostream * capture_stdout;
- std::unique_ptr<Pipe> capture_stdout_pipe;
+ std::unique_ptr<Channel> capture_stdout_pipe;
std::ostream * capture_stderr;
- std::unique_ptr<Pipe> capture_stderr_pipe;
+ std::unique_ptr<Channel> capture_stderr_pipe;
/* must be last, so the thread gets join()ed before its FDs vanish */
std::unique_ptr<Thread> thread;
@@ -204,6 +205,7 @@ namespace paludis
ProcessCommand command;
bool need_thread;
+ bool use_ptys;
std::ostream * capture_stdout;
std::ostream * capture_stderr;
@@ -213,6 +215,7 @@ namespace paludis
Imp(ProcessCommand && c) :
command(std::move(c)),
need_thread(false),
+ use_ptys(false),
capture_stdout(0),
capture_stderr(0)
{
@@ -240,13 +243,19 @@ Process::run()
if (_imp->capture_stdout)
{
thread->capture_stdout = _imp->capture_stdout;
- thread->capture_stdout_pipe.reset(new Pipe(true));
+ if (_imp->use_ptys)
+ thread->capture_stdout_pipe.reset(new Pty(true));
+ else
+ thread->capture_stdout_pipe.reset(new Pipe(true));
}
if (_imp->capture_stderr)
{
thread->capture_stderr = _imp->capture_stderr;
- thread->capture_stderr_pipe.reset(new Pipe(true));
+ if (_imp->use_ptys)
+ thread->capture_stderr_pipe.reset(new Pty(true));
+ else
+ thread->capture_stderr_pipe.reset(new Pipe(true));
}
}
@@ -323,6 +332,13 @@ Process::chdir(const FSEntry & f)
return *this;
}
+Process &
+Process::use_ptys()
+{
+ _imp->use_ptys = true;
+ return *this;
+}
+
namespace paludis
{
template <>