X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fexternaltask.h;h=9b9bc438867ce5884241249dedbe6b511af87ed8;hb=d1f9551e05c9d341149eb490e05b1465d3d6b711;hp=00465f3af4f3ba501952f1a7bf29ce149d04865a;hpb=4b075b4a7ed921be62740c302edeebcd8b06ca29;p=builder.git diff --git a/source/externaltask.h b/source/externaltask.h index 00465f3..9b9bc43 100644 --- a/source/externaltask.h +++ b/source/externaltask.h @@ -24,18 +24,19 @@ public: IGNORE //< Redirect the stream to oblivion }; - typedef Msp::Process::Arguments Arguments; + using Arguments = Msp::Process::Arguments; private: Arguments argv; Msp::FS::Path work_dir; - Msp::Process *process; - int exit_code; + Msp::Process *process = 0; + int exit_code = -1; + StreamAction stdin_action = PASSTHROUGH; Msp::FS::Path stdin_file; - StreamAction stdout_action; + StreamAction stdout_action = PASSTHROUGH; Msp::FS::Path stdout_file; - StreamAction stderr_action; - Msp::IO::Pipe *capture_pipe; + StreamAction stderr_action = PASSTHROUGH; + Msp::IO::Pipe *capture_pipe = 0; std::string output; public: @@ -44,12 +45,12 @@ public: name. If the working directory is not specified, no chdir is done. */ ExternalTask(const Arguments &, const Msp::FS::Path & = Msp::FS::Path()); - virtual ~ExternalTask(); + ~ExternalTask(); - virtual std::string get_command() const; - virtual void start(); - virtual Status check(); - virtual Status wait(); + std::string get_command() const override; + void start() override; + Status check() override; + Status wait() override; private: Status do_wait(bool); @@ -70,9 +71,9 @@ public: still running, but it will always return all output. */ const std::string &get_output() const { return output; } - /** Executes a command and captures its output. Stderr is ignored, but if - the command exits with a nonzero status, an exception is thrown. */ - static std::string run_and_capture_output(const Arguments &, const Msp::FS::Path & = Msp::FS::Path()); + /** Executes a command and captures its output. If the command exits with + a nonzero status, an exception is thrown. */ + static std::string run_and_capture_output(const Arguments &, const Msp::FS::Path & = Msp::FS::Path(), bool = false); }; #endif