subprocess 0.5.0
Modern subprocess library for c++
Loading...
Searching...
No Matches
Public Attributes | List of all members
subprocess::RunOptions Struct Reference

#include <ProcessBuilder.hpp>

Public Attributes

PipeVar cin = PipeOption::inherit
 
PipeVar cout = PipeOption::inherit
 
PipeVar cerr = PipeOption::inherit
 
bool new_process_group = false
 
std::string cwd
 
double timeout = -1
 
bool check = false
 
EnvMap env
 

Member Data Documentation

◆ cerr

PipeVar subprocess::RunOptions::cerr = PipeOption::inherit

Option for cout, or handle to use.

if a pipe handle is used it will be made inheritable automatically before process is created. You must call pipe_close on your end.

if std::ostream* or FILE* is provided you are responsible for ensuring its lifetime outlasts the Popen.

If you would like to create the closest thing to a realtime filter do as follows:

  1. cerr = PipeOption::pipe
  2. pipe_read_some(popen.cerr, true)

pipe_read_some will return as soon as any data is available. Sometimes with 0. If you wish to do a proper wait for some data to be avialable, poll() is available on all platforms even windows. Popen.cerr is the raw handle you can use as the fd parameter to poll().

◆ check

bool subprocess::RunOptions::check = false

Set to true for subprocess::run() to throw exception. Ignored when using Popen directly.

◆ cin

PipeVar subprocess::RunOptions::cin = PipeOption::inherit

Option for cin, data to pipe to cin. or created handle to use.

if a pipe handle is used it will be made inheritable automatically before process is created. You must call pipe_close on your end.

If std::istream* then you must make sure the life time of the stream is longer than Popen.

◆ cout

PipeVar subprocess::RunOptions::cout = PipeOption::inherit

Option for cout, or handle to use.

if a pipe handle is used it will be made inheritable automatically before process is created. You must call pipe_close on your end.

if std::ostream* or FILE* is provided you are responsible for ensuring its lifetime outlasts the Popen.

◆ cwd

std::string subprocess::RunOptions::cwd

current working directory for new process to use

◆ env

EnvMap subprocess::RunOptions::env

If empty inherits from current process

◆ new_process_group

bool subprocess::RunOptions::new_process_group = false

Set to true to run as new process group

◆ timeout

double subprocess::RunOptions::timeout = -1

Timeout in seconds. Raise TimeoutExpired.

Only available if you use subprocess_run. If timeout is reached process is killed() SIGKILL style, TimeoutExpired is thrown.


The documentation for this struct was generated from the following file: