peerplays-fc/include/fc/ssh/process.hpp

60 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include <fc/shared_ptr.hpp>
#include <fc/string.hpp>
namespace fc {
class istream;
class ostream;
namespace ssh {
class client;
namespace detail {
class process_impl;
};
/**
* Enables communication with a process executed via
* client::exec().
*
* Process can only be created by mace::ssh::client.
*/
2012-11-09 03:02:07 +00:00
class process { //: public fc::retainable {
public:
2012-11-09 03:02:07 +00:00
//typedef fc::shared_ptr<process> ptr;
process( const process& p );
process( process&& p );
2012-11-12 03:04:24 +00:00
process();
~process();
2012-11-12 03:04:24 +00:00
bool valid()const;
/**
* Blocks until the result code of the process has been returned.
*/
int result();
/**
* @brief returns a stream that writes to the procss' stdin
*/
2012-11-16 22:13:12 +00:00
fc::ostream& in_stream()const;
/**
* @brief returns a stream that reads from the process' stdout
*/
2012-11-16 22:13:12 +00:00
fc::istream& out_stream()const;
/**
* @brief returns a stream that reads from the process' stderr
*/
2012-11-16 22:13:12 +00:00
fc::istream& err_stream()const;
2013-02-04 02:11:08 +00:00
process& operator=( const process& p );
private:
friend class client;
process( client& c, const fc::string& cmd, const fc::string& pty_type = fc::string() );
fc::shared_ptr<detail::process_impl> my;
};
} } // fc::ssh