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,
49 std::string const & lpath, bool detach);
53 QString errorMessage() const;
54 QString exitStatusMessage() const;
56 QProcess* releaseProcess();
58 static void killProcess(QProcess * p);
64 void processError(QProcess::ProcessError);
65 void processStarted();
66 void processFinished(int, QProcess::ExitStatus status);
70 /// Pointer to the process to monitor.
73 /// Index to the standard output buffer.
75 /// Index to the standard error buffer.
80 std::string out_file_;
82 std::string err_file_;
85 static size_t const buffer_size_ = 200;
86 /// Standard output buffer.
87 char out_data_[buffer_size_];
88 /// Standard error buffer.
89 char err_data_[buffer_size_];
94 void waitAndProcessEvents();
100 } // namespace support
103 #endif // SYSTEMCALLPRIVATE_H