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
35 SystemcallPrivate(std::string const & infile, std::string const & outfile,
36 std::string const & errfile);
47 bool waitWhile(State, bool processEvents, int timeout = -1);
48 void startProcess(QString const & cmd, std::string const & path, bool detach);
52 QString errorMessage() const;
53 QString exitStatusMessage() const;
55 QProcess* releaseProcess();
57 static void killProcess(QProcess * p);
63 void processError(QProcess::ProcessError);
64 void processStarted();
65 void processFinished(int, QProcess::ExitStatus status);
69 /// Pointer to the process to monitor.
72 /// Index to the standard output buffer.
74 /// Index to the standard error buffer.
79 std::string out_file_;
81 std::string err_file_;
84 static size_t const buffer_size_ = 200;
85 /// Standard output buffer.
86 char out_data_[buffer_size_];
87 /// Standard error buffer.
88 char err_data_[buffer_size_];
93 void waitAndProcessEvents();
99 } // namespace support
102 #endif // SYSTEMCALLPRIVATE_H