Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
ProcessBuilder Class Reference

#include <elm/sys/ProcessBuilder.h>

Public Member Functions

 ProcessBuilder (sys::Path command)
 
void addArgument (string argument)
 
void add (string argument)
 
ProcessBuilderoperator+ (string argument)
 
ProcessBuilderoperator+= (string argument)
 
void setInput (SystemInStream *_in)
 
void setOutput (SystemOutStream *_out)
 
void setError (SystemOutStream *_out)
 
void setNewSession (bool enabled)
 
Processrun (void)
 

Detailed Description

This class is used to build a new process by launching a command line.

Constructor & Destructor Documentation

◆ ProcessBuilder()

ProcessBuilder ( sys::Path  command)

Construct a process builder.

Parameters
commandCommand to use. Construct a process builder.
commandCommand to use.

References Vector< T, E, A >::add().

Member Function Documentation

◆ add()

void add ( string  argument)
inline

◆ addArgument()

void addArgument ( string  argument)

Add an argument to the command line.

Parameters
argumentArgument to add.

References Vector< T, E, A >::add().

Referenced by ProcessBuilder::add(), ProcessBuilder::operator+(), and ProcessBuilder::operator+=().

◆ operator+()

ProcessBuilder& operator+ ( string  argument)
inline

◆ operator+=()

ProcessBuilder& operator+= ( string  argument)
inline

◆ run()

Process * run ( void  )

Run the built process.

Returns
The built process.
Exceptions
SystemExceptionThrown if there is an error during the build.

References elm::cerr, String::chars(), Vector< T, E, A >::count(), elm::cout, elm::io::endl, elm::io::err, elm::io::in, StringBuffer::length(), elm::io::out, and StringBuffer::toString().

◆ setError()

void setError ( SystemOutStream _err)

Set the error stream of the built process.

Parameters
_outNew process error.

◆ setInput()

void setInput ( SystemInStream _in)

Set the input stream of the built process.

Parameters
_inNew process input.

◆ setNewSession()

void setNewSession ( bool  enabled)

If the argument is true, the built process will run in its own session and is separated from the creator process. Practically, this means that the end of the parent process will not cause the end of the child process.

Parameters
enabledTrue to get a new session, false else.

◆ setOutput()

void setOutput ( SystemOutStream _out)

Set the output stream of the built process.

Parameters
_outNew process output.

The documentation for this class was generated from the following files: