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);
37 /// Should the standard output be displayed?
38 void setShowOut(bool val) { showout_ = val; }
40 /// Should the standard error be displayed?
41 void setShowErr(bool val) { showerr_ = val; }
51 bool waitWhile(State, bool processEvents, int timeout = -1);
52 void startProcess(const QString& cmd);
56 QString errorMessage() const;
57 QString exitStatusMessage() const;
61 QProcess* releaseProcess();
63 static void killProcess(QProcess * p);
66 /// Pointer to the process to monitor.
68 /// Index to the standard output buffer.
70 /// Index to the standard error buffer.
75 static size_t const bufsize_ = 200;
76 /// Standard output buffer.
77 char outdata_[bufsize_];
78 /// Standard error buffer.
79 char errdata_[bufsize_];
87 void waitAndProcessEvents();
95 void processError(QProcess::ProcessError);
96 void processStarted();
97 void processFinished(int, QProcess::ExitStatus status);
103 } // namespace support
106 #endif // SYSTEMCALLPRIVATE_H