3 * \file SystemcallPrivate.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Enrico Forestieri
9 * Full author contact details are available in file CREDITS.
12 #ifndef SYSTEMCALLPRIVATE_H
13 #define SYSTEMCALLPRIVATE_H
26 * Outputs to the console terminal the line buffered standard output and
27 * error of a spawned process when there is a controlling terminal and
28 * stdout/stderr have not been redirected.
30 class SystemcallPrivate : public QObject
34 SystemcallPrivate(std::string const & outfile);
45 bool waitWhile(State, bool processEvents, int timeout = -1);
46 void startProcess(const QString& cmd);
50 QString errorMessage() const;
51 QString exitStatusMessage() const;
55 QProcess* releaseProcess();
57 static void killProcess(QProcess * p);
60 /// Pointer to the process to monitor.
62 /// Index to the standard output buffer.
64 /// Index to the standard error buffer.
69 static size_t const bufsize_ = 200;
70 /// Standard output buffer.
71 char outdata_[bufsize_];
72 /// Standard error buffer.
73 char errdata_[bufsize_];
75 bool terminalErrExists_;
77 bool terminalOutExists_;
81 void waitAndProcessEvents();
89 void processError(QProcess::ProcessError);
90 void processStarted();
91 void processFinished(int, QProcess::ExitStatus status);
97 } // namespace support
100 #endif // SYSTEMCALLPRIVATE_H