View source code
Display the source code in std/process.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Struct std.process.Config

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

struct Config ;

Fields

NameTypeDescription
flags Config.FlagsFlag options. Use bitwise OR to combine flags.
preExecDelegate nothrow @nogc @safe bool delegate()A delegate that is called before exec in spawnProcess. It returns true if succeeded and otherwise returns false.
preExecFunction nothrow @nogc @safe bool function()A function that is called before exec in spawnProcess. It returns true if succeeded and otherwise returns false.

Methods

NameDescription
opBinary (other) For backwards compatibility, and cases when only flags need to be specified in the Config, these allow building Config instances using flag names only.
opOpAssign (other) For backwards compatibility, and cases when only flags need to be specified in the Config, these allow building Config instances using flag names only.
opUnary () For backwards compatibility, and cases when only flags need to be specified in the Config, these allow building Config instances using flag names only.

Enums

NameDescription
Flags Flag options. Use bitwise OR to combine flags.

Example

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();
}

Authors

Lars Tandle Kyllingstad, Steven Schveighoffer, Vladimir Panteleev

License

Boost License 1.0.