Apache Mesos
Classes | Namespaces | Typedefs | Functions
subprocess.hpp File Reference
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <process/future.hpp>
#include <stout/flags.hpp>
#include <stout/lambda.hpp>
#include <stout/none.hpp>
#include <stout/option.hpp>
#include <stout/try.hpp>
#include <stout/os/exec.hpp>
#include <stout/os/shell.hpp>
#include <stout/os/int_fd.hpp>

Go to the source code of this file.

Classes

class  process::Subprocess
 Represents a fork() exec()ed subprocess. More...
 
class  process::Subprocess::IO
 Describes how the I/O is redirected for stdin/stdout/stderr. More...
 
struct  process::Subprocess::IO::InputFileDescriptors
 For input file descriptors a child reads from the read file descriptor and a parent may write to the write file descriptor if one is present. More...
 
struct  process::Subprocess::IO::OutputFileDescriptors
 For output file descriptors a child writes to the write file descriptor and a parent may read from the read file descriptor if one is present. More...
 
struct  process::Subprocess::ParentHook
 A hook can be passed to a subprocess call. More...
 
class  process::Subprocess::ChildHook
 A ChildHook can be passed to a subprocess call. More...
 

Namespaces

 process
 

Typedefs

using process::InputFileDescriptors = Subprocess::IO::InputFileDescriptors
 
using process::OutputFileDescriptors = Subprocess::IO::OutputFileDescriptors
 

Functions

Try< Subprocess > process::subprocess (const std::string &path, std::vector< std::string > argv, const Subprocess::IO &in=Subprocess::FD(STDIN_FILENO), const Subprocess::IO &out=Subprocess::FD(STDOUT_FILENO), const Subprocess::IO &err=Subprocess::FD(STDERR_FILENO), const flags::FlagsBase *flags=nullptr, const Option< std::map< std::string, std::string >> &environment=None(), const Option< lambda::function< pid_t(const lambda::function< int()> &)>> &clone=None(), const std::vector< Subprocess::ParentHook > &parent_hooks={}, const std::vector< Subprocess::ChildHook > &child_hooks={}, const std::vector< int_fd > &whitelist_fds={})
 Forks a subprocess and execs the specified 'path' with the specified 'argv', redirecting stdin, stdout, and stderr as specified by 'in', 'out', and 'err' respectively. More...
 
Try< Subprocess > process::subprocess (const std::string &command, const Subprocess::IO &in=Subprocess::FD(STDIN_FILENO), const Subprocess::IO &out=Subprocess::FD(STDOUT_FILENO), const Subprocess::IO &err=Subprocess::FD(STDERR_FILENO), const Option< std::map< std::string, std::string >> &environment=None(), const Option< lambda::function< pid_t(const lambda::function< int()> &)>> &clone=None(), const std::vector< Subprocess::ParentHook > &parent_hooks={}, const std::vector< Subprocess::ChildHook > &child_hooks={}, const std::vector< int_fd > &whitelist_fds={})
 Overload of 'subprocess' for launching a shell command, i.e., 'sh -c command'. More...