+public:
+ enum StreamAction
+ {
+ PASSTHROUGH, //< Do not touch the stream
+ CAPTURE, //< Capture the stream
+ REDIRECT, //< Redirect the stream to/from a file
+ IGNORE //< Redirect the stream to oblivion
+ };
+
+ using Arguments = Msp::Process::Arguments;
+
+private:
+ Arguments argv;
+ Msp::FS::Path work_dir;
+ Msp::Process *process = 0;
+ int exit_code = -1;
+ StreamAction stdin_action = PASSTHROUGH;
+ Msp::FS::Path stdin_file;
+ StreamAction stdout_action = PASSTHROUGH;
+ Msp::FS::Path stdout_file;
+ StreamAction stderr_action = PASSTHROUGH;
+ Msp::IO::Pipe *capture_pipe = 0;
+ std::string output;
+
+public:
+ /** Creates an ExternalTask with an argument array and an optional working
+ directory. The first element of the argument array should be the command
+ name. If the working directory is not specified, no chdir is done. */
+ ExternalTask(const Arguments &, const Msp::FS::Path & = Msp::FS::Path());
+
+ ~ExternalTask();
+
+ std::string get_command() const override;
+ void start() override;
+ Status check() override;
+ Status wait() override;