]> git.lyx.org Git - lyx.git/blobdiff - src/support/Systemcall.cpp
InsetTabular.cpp: fix #6585 also for wrapped floats - thanks Vincent
[lyx.git] / src / support / Systemcall.cpp
index ab1ef6029906b70a904524ab6ce8bf3505edefd7..dda23d66bce1d83369ca2d168a30bfbfda04fbf4 100644 (file)
@@ -246,8 +246,6 @@ SystemcallPrivate::SystemcallPrivate(const std::string& of) :
                                 out_index_(0),
                                 err_index_(0),
                                 out_file_(of), 
-                                terminal_out_exists_(os::is_terminal(os::STDOUT)),
-                                terminal_err_exists_(os::is_terminal(os::STDERR)),
                                 process_events_(false)
 {
        if (!out_file_.empty()) {
@@ -327,20 +325,16 @@ bool SystemcallPrivate::waitWhile(State waitwhile, bool process_events, int time
 
 SystemcallPrivate::~SystemcallPrivate()
 {
-       flush();
-
        if (out_index_) {
                out_data_[out_index_] = '\0';
                out_index_ = 0;
-               if (terminal_out_exists_)
-                       cout << out_data_;
+               cout << out_data_;
        }
        cout.flush();
        if (err_index_) {
                err_data_[err_index_] = '\0';
                err_index_ = 0;
-               if (terminal_err_exists_)
-                       cerr << err_data_;
+               cerr << err_data_;
        }
        cerr.flush();
 
@@ -348,26 +342,6 @@ SystemcallPrivate::~SystemcallPrivate()
 }
 
 
-void SystemcallPrivate::flush()
-{
-       if (process_) {
-               // If the output has been redirected, we write it all at once.
-               // Even if we are not running in a terminal, the output could go
-               // to some log file, for example ~/.xsession-errors on *nix.
-               
-               QString data = QString::fromLocal8Bit(process_->readAllStandardOutput().data());
-               ProgressInterface::instance()->appendMessage(data);
-               if (!terminal_out_exists_ && out_file_.empty())
-                       cout << fromqstr(data);
-               
-               data = QString::fromLocal8Bit(process_->readAllStandardError().data());
-               ProgressInterface::instance()->appendError(data);
-               if (!terminal_err_exists_)
-                       cerr << fromqstr(data);
-       }
-}
-
-
 void SystemcallPrivate::stdOut()
 {
        if (process_) {
@@ -375,12 +349,11 @@ void SystemcallPrivate::stdOut()
                process_->setReadChannel(QProcess::StandardOutput);
                while (process_->getChar(&c)) {
                        out_data_[out_index_++] = c;
-                       if (c == '\n' || out_index_ + 1 == max_buffer_size_) {
+                       if (c == '\n' || out_index_ + 1 == buffer_size_) {
                                out_data_[out_index_] = '\0';
                                out_index_ = 0;
                                ProgressInterface::instance()->appendMessage(QString::fromLocal8Bit(out_data_));
-                               if (terminal_out_exists_)
-                                       cout << out_data_;
+                               cout << out_data_;
                        }
                }
        }
@@ -394,12 +367,11 @@ void SystemcallPrivate::stdErr()
                process_->setReadChannel(QProcess::StandardError);
                while (process_->getChar(&c)) {
                        err_data_[err_index_++] = c;
-                       if (c == '\n' || err_index_ + 1 == max_buffer_size_) {
+                       if (c == '\n' || err_index_ + 1 == buffer_size_) {
                                err_data_[err_index_] = '\0';
                                err_index_ = 0;
                                ProgressInterface::instance()->appendError(QString::fromLocal8Bit(err_data_));
-                               if (terminal_err_exists_)
-                                       cerr << err_data_;
+                               cerr << err_data_;
                        }
                }
        }