Process

Process encapsulates several useful methods of std.process to make a serializable, synchronous process.

Constructors

this
this()

Members

Functions

environment
void environment(const(char)[] value)
const(char)[] environment()

Sets or gets the environment.

environmentAA
string[string] environmentAA()

The environment, as an associative array.

error
File error()

The process error stream.

errorToOutput
void errorToOutput(bool value)
bool errorToOutput()

Sets or gets if the error stream is redirected to the output stream. Only applied if usePipes is set to true.

executable
void executable(const(char)[] value)
const(char)[] executable()

Sets or gets the process executable.

execute
void execute()

Executes the process and returns when it terminates.

executeAndPipeFile
void executeAndPipeFile(const(char[]) filename)

Executes, fills the input stream with a file and finally closes the input.

executeAndWrite
void executeAndWrite(auto ref T t)

Executes then writes and finally closes the input stream.

exitStatus
int exitStatus()

Indicates the process exit status.

fullEnvironment
string fullEnvironment()

Returns the full environment.

hideConsole
void hideConsole(bool value)
bool hideConsole()

Sets or gets if the console of the program is visible.

input
File input()

The process input stream.

internalExec
void internalExec()

default, non blocking, execute

isShellCommand
void isShellCommand(bool value)
bool isShellCommand()

Sets or gets if the executable field actually represents a shell command.

newEnvironment
void newEnvironment(bool value)
bool newEnvironment()

Sets or gets if the value passed in environment fully replaces the default environment.

output
File output()

The process output stream.

parameters
void parameters(string value)
string parameters()

Sets or gets the parameters for this process.

terminate
void terminate(int status = 0)

Forces the process termination.

terminated
bool terminated()

Indicates wether the process is terminated.

usePipes
void usePipes(bool value)
bool usePipes()

Sets or gets if the process streams are redirected.

waitFor
int waitFor()

Waits for the process and only returns when it terminates.

workingDirectory
void workingDirectory(const(char)[] value)
const(char)[] workingDirectory()

Sets or gets the process working directory.

Inherited Members

From PropertyPublisher

publicationCount
size_t publicationCount()

Returns the count of descriptor this class publishes.

publicationFromName
GenericDescriptor* publicationFromName(const(char)[] name)

Returns a pointer to a descriptor according to its name. Similar to the publication() function template excepted that the result type has not to be specified.

publicationFromIndex
GenericDescriptor* publicationFromIndex(size_t index)

Returns a pointer the index-th descriptor. Index must be within the [0 .. publicationCount] range.

declarator
Object declarator()
void declarator(Object value)

Pointer to the object that has created the descriptor leading to this PropertyPublisher instance.

Examples

1 Process prc = construct!Process;
2 scope(exit) prc.destruct;
3 
4 prc.executable = "echo";
5 prc.parameters = "123";
6 prc.usePipes = true;
7 prc.execute;
8 assert(prc.output.readln == "123\n");

Meta