Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Function shell

boost::process::shell

Synopsis

// In header: <boost/process/operations.hpp>


template<typename Context> 
  child shell(const std::string & command, Context ctx);
child shell(const std::string & command);

Description

Starts a shell-based command.

Executes the given command through the default system shell. The command is subject to pattern expansion, redirection and pipelining. The shell is launched as described by the parameters in the context.

This function behaves similarly to the system(3) system call. In a POSIX system, the command is fed to /bin/sh whereas under a Windows system, it is fed to cmd.exe. It is difficult to write portable commands, but this function comes in handy in multiple situations.

Blocking remarks: This function may block if the device holding the executable blocks when loading the image. This might happen if, e.g., the binary is being loaded from a network share.

Returns:

A handle to the new child process.


PrevUpHomeNext