45 G_EXCEPTION( Busy ,
"cannot execute command-line task: still busy from last time" ) ;
46 G_EXCEPTION( Error ,
"asynchronous task error" ) ;
47 G_EXCEPTION( Failed ,
"failed to collect task exit status" ) ;
50 const std::string & exec_error_format = std::string() ,
72 void operator=(
const Task & ) ;
74 void done(
int exit_code , std::string output ) ;
75 void exception( std::exception & ) ;
78 unique_ptr<TaskImp> m_imp ;
81 std::string m_exec_error_format ;
92 virtual void onTaskDone(
int exit_status ,
const std::string & output ) = 0 ;
static Identity invalid()
Returns an invalid identity.
Task(TaskCallback &, ExceptionHandler &eh, const std::string &exec_error_format=std::string(), const G::Identity &=G::Identity::invalid())
Constructor for a start()able object.
A combination of user-id and group-id, with a very low-level interface to the get/set/e/uid/gid funct...
void start(const G::ExecutableCommand &commandline)
Starts the task by spawning a new process with the given command-line and also starting a thread to w...
A private implementation class used by GNet::Task.
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket events...
void stop()
Attempts to kill the spawned process and waits for it to terminate.
virtual void onTaskDone(int exit_status, const std::string &output)=0
Callback function to signal task completion.
A class for running an exectuable in a separate process with an asychronous completion callback...
A structure representing an external program, holding a path and a set of arguments.
An abstract interface for callbacks from GNet::Task.
virtual ~TaskCallback()
Destructor.