vibe.d beta banner
get vibe.d

Asynchronous I/O that doesn’t get in your way, written in D

Function EventDriverProcesses.spawn

Spawn a child process.

abstract Process spawn (
  string[] args,
  std.variant.VariantN!(4L,int,eventcore.driver.ProcessRedirect) stdin,
  std.variant.VariantN!(4L,int,eventcore.driver.ProcessRedirect,eventcore.driver.ProcessStdoutRedirect) stdout,
  std.variant.VariantN!(4L,int,eventcore.driver.ProcessRedirect,eventcore.driver.ProcessStderrRedirect) stderr,
  const(string[string]) env = cast(const(string[string]))null,
  ProcessConfig config = Config(Flags.none, null),
  string working_dir = null
) nothrow @safe;

Note that if a default signal handler exists for the signal, it will be disabled by using this function.


args The program arguments. First one must be an executable.
stdin What should be done for stdin. Allows inheritance, piping, nothing or any specific fd. If this results in a Pipe, the PipeFD will be set in the stdin result.
stdout See stdin, but also allows redirecting to stderr.
stderr See stdin, but also allows redirecting to stdout.
env The environment variables to spawn the process with.
config Special process configurations.
working_dir What to set the working dir in the process.


Returns a Process struct containing the ProcessID and whatever pipes have been adopted for stdin, stdout and stderr.