- connect(proc, SIGNAL(readyReadStandardOutput()), SLOT(stdOut()));
- connect(proc, SIGNAL(readyReadStandardError()), SLOT(stdErr()));
- connect(proc, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError)));
- connect(proc, SIGNAL(started()), this, SLOT(processStarted()));
- connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus)));
+ if (!outfile.empty()) {
+ // Check whether we have to simply throw away the output.
+ if (outfile != os::nulldev())
+ proc_->setStandardOutputFile(toqstr(outfile));
+ } else if (os::is_terminal(os::STDOUT))
+ showout();
+ if (os::is_terminal(os::STDERR))
+ showerr();
+
+ connect(proc_, SIGNAL(readyReadStandardOutput()), SLOT(stdOut()));
+ connect(proc_, SIGNAL(readyReadStandardError()), SLOT(stdErr()));
+ connect(proc_, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError)));
+ connect(proc_, SIGNAL(started()), this, SLOT(processStarted()));
+ connect(proc_, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus)));