2013-06-05 19:19:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
#include <fc/interprocess/iprocess.hpp>
|
|
|
|
|
|
|
|
|
|
namespace fc {
|
|
|
|
|
|
|
|
|
|
fc::path find_executable_in_path( const fc::string name );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief start and manage an local process
|
|
|
|
|
* @note this class implements reference semantics.
|
|
|
|
|
*/
|
|
|
|
|
class process : public iprocess
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
process();
|
|
|
|
|
~process();
|
|
|
|
|
|
|
|
|
|
virtual iprocess& exec( const fc::path& exe,
|
2013-06-27 18:19:08 +00:00
|
|
|
std::vector<std::string> args,
|
2013-06-05 19:19:00 +00:00
|
|
|
const fc::path& work_dir = fc::path(),
|
|
|
|
|
exec_opts opts = open_all );
|
|
|
|
|
|
2014-05-14 12:51:30 +00:00
|
|
|
|
|
|
|
|
virtual int result(const microseconds& timeout = microseconds::maximum());
|
2013-06-05 19:19:00 +00:00
|
|
|
virtual void kill();
|
|
|
|
|
virtual fc::buffered_ostream_ptr in_stream();
|
|
|
|
|
virtual fc::buffered_istream_ptr out_stream();
|
|
|
|
|
virtual fc::buffered_istream_ptr err_stream();
|
|
|
|
|
|
|
|
|
|
class impl;
|
|
|
|
|
private:
|
|
|
|
|
std::unique_ptr<impl> my;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::shared_ptr<process> process_ptr;
|
|
|
|
|
|
|
|
|
|
} // namespace fc
|