numerous bug fixes
This commit is contained in:
parent
3fb9857504
commit
4812477ea6
4 changed files with 19 additions and 11 deletions
|
|
@ -167,18 +167,20 @@ namespace fc {
|
|||
future( const shared_ptr<promise<T>>& p ):m_prom(p){}
|
||||
future( shared_ptr<promise<T>>&& p ):m_prom(fc::move(p)){}
|
||||
future(){}
|
||||
|
||||
operator const T&()const { return wait(); }
|
||||
|
||||
/// @pre valid()
|
||||
/// @post ready()
|
||||
/// @throws timeout
|
||||
const T& wait( const microseconds& timeout = microseconds::max() ){
|
||||
const T& wait( const microseconds& timeout = microseconds::max() )const {
|
||||
return m_prom->wait(timeout);
|
||||
}
|
||||
|
||||
/// @pre valid()
|
||||
/// @post ready()
|
||||
/// @throws timeout
|
||||
const T& wait_until( const time_point& tp ) {
|
||||
const T& wait_until( const time_point& tp )const {
|
||||
return m_prom->wait_until(tp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ namespace fc {
|
|||
}
|
||||
|
||||
struct impl_base : public fc::retainable {
|
||||
virtual ~impl_base(){}
|
||||
virtual void write( const char* buf, size_t len ) = 0;
|
||||
virtual void close() = 0;
|
||||
virtual void flush() = 0;
|
||||
|
|
@ -85,9 +86,10 @@ namespace fc {
|
|||
|
||||
protected:
|
||||
struct impl_base : public fc::retainable {
|
||||
virtual void read( char* buf, size_t len ) = 0;
|
||||
virtual size_t readsome( char* buf, size_t len ) = 0;
|
||||
virtual bool eof()const;
|
||||
virtual ~impl_base(){}
|
||||
virtual void read( char* buf, size_t len )=0;
|
||||
virtual size_t readsome( char* buf, size_t len )=0;
|
||||
virtual bool eof()const=0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
#include <fc/json_rpc_client.hpp>
|
||||
#include <fc/json_rpc_stream_connection.hpp>
|
||||
#include <fc/process.hpp>
|
||||
#include <fc/filesystem.hpp>
|
||||
|
||||
namespace fc { namespace json {
|
||||
|
||||
|
|
@ -9,7 +11,7 @@ namespace fc { namespace json {
|
|||
public:
|
||||
|
||||
fc::future<int> exec( const fc::path& exe, int opt = fc::process::open_all ) {
|
||||
return exec( exe, fc::path(), opt );
|
||||
return exec( exe, fc::path("."), opt );
|
||||
}
|
||||
fc::future<int> exec( const fc::path& exe, const fc::path& wd,
|
||||
int opt = fc::process::open_all ) {
|
||||
|
|
@ -17,14 +19,16 @@ namespace fc { namespace json {
|
|||
}
|
||||
fc::future<int> exec( const fc::path& exe, fc::vector<fc::string>&& args ,
|
||||
int opt = fc::process::open_all ) {
|
||||
return exec( exe, fc::move(args), fc::path(), opt );
|
||||
return exec( exe, fc::move(args), fc::path("."), opt );
|
||||
}
|
||||
fc::future<int> exec( const fc::path& exe, fc::vector<fc::string>&& args,
|
||||
const fc::path& wd, int opt = fc::process::open_all ) {
|
||||
auto r = _proc.exec( exe, fc::move(args), wd, opt );
|
||||
slog( "cd %s; %s", wd.generic_string().c_str(), exe.generic_string().c_str() );
|
||||
auto r = _proc.exec( canonical(exe), fc::move(args), wd, opt );
|
||||
_con.reset( new fc::json::rpc_stream_connection( _proc.out_stream(), _proc.in_stream() ) );
|
||||
this->_vtable.reset(new fc::detail::vtable<InterfaceType,fc::json::detail::rpc_member>() );
|
||||
this->_vtable->template visit<InterfaceType>( fc::json::detail::vtable_visitor(_con) );
|
||||
rpc_connection::ptr p(_con);
|
||||
this->_vtable->template visit_other<InterfaceType>( fc::json::detail::vtable_visitor(p) );
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +39,7 @@ namespace fc { namespace json {
|
|||
*/
|
||||
fc::istream& err_stream() { return _proc.err_stream(); }
|
||||
|
||||
template<typename T&&>
|
||||
template<typename T>
|
||||
void on_close( T&& f) { _con->on_close( fc::forward<T>(f) ); }
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ fc::future<int> process::exec( const fc::path& exe, fc::vector<fc::string>&& arg
|
|||
promise<int>::ptr p(new promise<int>("process"));
|
||||
my->stat.async_wait( my->child->get_id(), [=]( const boost::system::error_code& ec, int exit_code )
|
||||
{
|
||||
slog( "process::result %1%", exit_code );
|
||||
slog( "process::result %d", exit_code );
|
||||
if( !ec ) {
|
||||
#ifdef BOOST_POSIX_API
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue