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
24 * Outputs to the console terminal the line buffered standard output and
25 * error of a spawned process when there is a controlling terminal and
26 * stdout/stderr have not been redirected.
28 class SystemcallPrivate : public QObject
33 SystemcallPrivate(std::string const & infile, std::string const & outfile,
34 std::string const & errfile);
46 bool waitWhile(State, bool processEvents, int timeout = -1);
47 void startProcess(QString const & cmd, std::string const & path,
48 std::string const & lpath, bool detach);
52 QString errorMessage() const;
53 QString exitStatusMessage() const;
55 QProcess* releaseProcess();
57 static void killProcess(QProcess * p);
59 // when true, kill any running script ASAP
60 static bool kill_script;
66 void processError(QProcess::ProcessError);
67 void processStarted();
68 void processFinished(int, QProcess::ExitStatus status);
72 /// Pointer to the process to monitor.
75 /// Index to the standard output buffer.
77 /// Index to the standard error buffer.
82 std::string out_file_;
84 std::string err_file_;
87 static size_t const buffer_size_ = 200;
88 /// Standard output buffer.
89 char out_data_[buffer_size_];
90 /// Standard error buffer.
91 char err_data_[buffer_size_];
96 void waitAndProcessEvents();
100 /// returns false if we killed the process
101 /// actually returns Systemcall::ReturnValue
105 } // namespace support
108 #endif // SYSTEMCALLPRIVATE_H