Config

Options that control the behaviour of process creation functions in this module. Most options only apply to spawnProcess and spawnShell.

Members

Enums

Flags
enum Flags

Flag options. Use bitwise OR to combine flags.

Variables

detached
enum Config detached;

For backwards compatibility, and cases when only flags need to be specified in the Config, these allow building Config instances using flag names only.

flags
Flags flags;

Flag options. Use bitwise OR to combine flags.

inheritFDs
enum Config inheritFDs;
newEnv
enum Config newEnv;

For backwards compatibility, and cases when only flags need to be specified in the Config, these allow building Config instances using flag names only.

none
enum Config none;

For backwards compatibility, and cases when only flags need to be specified in the Config, these allow building Config instances using flag names only.

preExecFunction
bool function() nothrow @(nogc) @(safe) preExecFunction;

A function that is called before exec in spawnProcess. It returns true if succeeded and otherwise returns false.

retainStderr
enum Config retainStderr;
retainStdin
enum Config retainStdin;
retainStdout
enum Config retainStdout;
stderrPassThrough
enum Config stderrPassThrough;
suppressConsole
enum Config suppressConsole;

For backwards compatibility, and cases when only flags need to be specified in the Config, these allow building Config instances using flag names only.

Examples

auto logFile = File("myapp_error.log", "w");

// Start program, suppressing the console window (Windows only),
// redirect its error stream to logFile, and leave logFile open
// in the parent process as well.
auto pid = spawnProcess("myapp", stdin, stdout, logFile,
                        Config.retainStderr | Config.suppressConsole);
scope(exit)
{
    auto exitCode = wait(pid);
    logFile.writeln("myapp exited with code ", exitCode);
    logFile.close();
}

Meta