D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Wed Apr 23 23:20:11 2008

# std.process

Authors:
Walter Bright, Andrei Alexandrescu

int system(string command);
  Execute command in a command shell.
  Returns:
  exit status of command
int execv(string pathname, invariant(char)[][] argv);
int execve(string pathname, invariant(char)[][] argv, invariant(char)[][] envp);
int execvp(string pathname, invariant(char)[][] argv);
int execvpe(string pathname, invariant(char)[][] argv, invariant(char)[][] envp);
  Execute program specified by pathname, passing it the arguments (argv) and the environment (envp), returning the exit status. The 'p' versions of exec search the PATH environment variable setting for the program.
string shell(string cmd);
  Runs cmd in a shell and returns its standard output. If the process could not be started or exits with an error code, throws an exception.
  Example:

         auto tempFilename = chomp(shell("mcookie"));
         auto f = enforce(fopen(tempFilename), "w");
         scope(exit)
         {
             fclose(f) == 0 || assert(false);
             system("rm " ~ tempFilename);
         }
         ... use f ...

Copyright © 1999-2008 by Digital Mars, All Rights Reserved | Page generated by Ddoc.