Spm::Util::Command Class Reference

Launch command and get their output. More...

#include <command.h>

List of all members.

Public Member Functions

 Command (const std::string &cmd)
 Command ()
void setCommand (const std::string &cmd)
void add (const std::string &arg)
 add an argument to the command line
void add (const std::string &var, const std::string &val)
 add an environement variable
bool execSync (std::string &out, std::string &err)
 Execute this Command synchronously.
bool execASync (int &out, int &err, int &in)
 Execute this Command asynchronously.
const boost::filesystem::path & getWorkingDir ()
void setWorkingDir (const boost::filesystem::path &dir)
unsigned int getPid ()
int getReturnValue ()
bool wait ()
 Wait for the end of the execution of the command.
void kill (int signal=9)

Static Public Member Functions

static int exec (const std::string &cmd, std::string &out, std::string &err)


Detailed Description

Launch command and get their output.


Constructor & Destructor Documentation

Spm::Util::Command::Command const std::string &  cmd  ) 
 

Parameters:
cmd The commmand to run

Spm::Util::Command::Command  ) 
 


Member Function Documentation

void Spm::Util::Command::add const std::string &  var,
const std::string &  val
 

add an environement variable

Parameters:
var The name of the variable
val The value of the variable

void Spm::Util::Command::add const std::string &  arg  ) 
 

add an argument to the command line

Parameters:
arg The arg to add

static int Spm::Util::Command::exec const std::string &  cmd,
std::string &  out,
std::string &  err
[static]
 

bool Spm::Util::Command::execASync int &  out,
int &  err,
int &  in
 

Execute this Command asynchronously.

Parameters:
out The output stream of the launched command
err The err stream of the launched command
in The input stream of the launched command

bool Spm::Util::Command::execSync std::string &  out,
std::string &  err
 

Execute this Command synchronously.

Parameters:
out The output of this command
err The error of this command

unsigned int Spm::Util::Command::getPid  ) 
 

Returns:
The PID of this launched Command

int Spm::Util::Command::getReturnValue  ) 
 

Returns:
the value returned by the command

const boost::filesystem::path& Spm::Util::Command::getWorkingDir  ) 
 

Returns:
The directory from where this Command is executed

void Spm::Util::Command::kill int  signal = 9  ) 
 

void Spm::Util::Command::setCommand const std::string &  cmd  ) 
 

void Spm::Util::Command::setWorkingDir const boost::filesystem::path &  dir  ) 
 

Parameters:
dir The directory from where this Command will be executed

bool Spm::Util::Command::wait  ) 
 

Wait for the end of the execution of the command.

Returns:
false if an error occured while waiting


The documentation for this class was generated from the following file:
Generated on Wed Jul 4 15:27:21 2007 for libSpm by  doxygen 1.4.6