Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Global shell

boost::process::shell

Synopsis

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

unspecified shell;

Description

The shell property enables to launch a program through the shell of the system.

system("gcc", shell);

The shell argument goes without any expression. The operator() is overloaded, to obtain the path of the system shell.

auto shell_cmd = shell();
//avoid exceptions
std::error_code ec;
shell_cmd = shell(ec);
[Note] Note

Launching through the shell will NOT provide proper error handling, i.e. you will get an error via the return code.

[Note] Note

Executing shell commands that incorporate unsanitized input from an untrusted source makes a program vulnerable to shell injection, a serious security flaw which can result in arbitrary command execution. For this reason, the use of shell is strongly discouraged in cases where the command string is constructed from external input:


PrevUpHomeNext