std.process.system and friends
Ali Çehreli
acehreli at yahoo.com
Sun Feb 3 07:47:13 PST 2013
On 02/02/2013 03:41 AM, Gor Gyolchanyan wrote:
> How can I set my local envoronment variables so that further calls to
> std.process.system can pick it up?
std.process has the nice AA-like 'environment':
import std.process;
void main()
{
environment["MY_ENV_VAR"] = "42";
system("echo $MY_ENV_VAR"); // <-- prints "42"
assert(shell("echo $MY_ENV_VAR") == "42\n");
}
There is also 'setenv' in that module but I find 'environment' more
convenient. (Also, 'setenv' is evil because it has a bool parameter. ;))
Ali
More information about the Digitalmars-d-learn
mailing list