std.process
Authors:Walter Bright, Andrei Alexandrescu
- コマンドシェルで command を実行します
Returns:
command が null の場合、 コマンドシェルが存在すれば非ゼロ、しなければゼロを返します。command が null でない場合、エラー時には -1、コマンドが実行されたときには command の終了コードを返します。
Note:
On Unix systems, the homonym C function (which is accessible to D programs as std.c.system) returns a code in the same format as waitpid, meaning that C programs must use the WEXITSTATUS macro to extract the actual exit code from the system call. D's system automatically extracts the exit status.
- pathname で指定されたプログラムを、引数 (argv)
と環境変数 (envp) を与えて実行し、その終了ステータスを返します。
'p' のついたバージョンは、program の探索のために
PATH 環境変数を参照します。
- cmd をシェルで実行し、その標準出力を返します。
プロセスが実行できなかったときやエラーで終了したときは、
例外を投げます。
Example:
auto tempFilename = chomp(shell("mcookie")); auto f = enforce(fopen(tempFilename), "w"); scope(exit) { fclose(f) == 0 || assert(false); system("rm " ~ tempFilename); } ... use f ...
- 環境変数 name の値を文字列で取得します。
内部で std.c.stdlib.getenv
を呼び出します。
- 環境変数 name に値 value をセットします。
value が書き込まれた場合、または既に値が設定済みで overwrite が false の場合、正常終了します。そうでない場合、
例外を投げます。内部で std.c.stdlib.setenv を呼び出します。
- Removes variable name from the environment. Calls std.c.stdlib.unsetenv internally.
