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);
48 bool waitWhile(State, bool processEvents, int timeout = -1);
49 void startProcess(QString const & cmd, std::string const & path,
50 std::string const & lpath, bool detach);
54 QString errorMessage() const;
55 QString exitStatusMessage() const;
57 QProcess* releaseProcess();
59 static void killProcess(QProcess * p);
61 // when true, kill any running script ASAP
62 static bool kill_script;
68 void processError(QProcess::ProcessError);
69 void processStarted();
70 void processFinished(int, QProcess::ExitStatus status);
74 /// Pointer to the process to monitor.
77 /// Index to the standard output buffer.
79 /// Index to the standard error buffer.
84 std::string out_file_;
86 std::string err_file_;
89 static size_t const buffer_size_ = 200;
90 /// Standard output buffer.
91 char out_data_[buffer_size_];
92 /// Standard error buffer.
93 char err_data_[buffer_size_];
98 void waitAndProcessEvents();
102 /// returns false if we killed the process
103 /// actually returns Systemcall::ReturnValue
107 } // namespace support
110 #endif // SYSTEMCALLPRIVATE_H