Lines Matching refs:environment
5 working with the current process' execution environment.
65 $(LREF environment) is an interface through which the current process'
66 environment variables can be read and manipulated.)
88 $(LREF environment), $(LREF thisProcessID) and $(LREF thisThreadID).
193 abstract final class environment
200 Retrieves the value of the environment variable with the given `name`.
202 auto path = environment["PATH"];
206 $(OBJECTREF Exception) if the environment variable does not exist,
211 $(LREF environment.get), which doesn't throw on failure.
220 Retrieves the value of the environment variable with the given `name`,
223 Unlike $(LREF environment.opIndex), this function never throws on Posix.
225 auto sh = environment.get("SHELL", "/bin/sh");
228 environment variable.
230 auto myVar = environment.get("MYVAR");
240 name = name of the environment variable to retrieve
241 defaultValue = default value to return if the environment variable doesn't exist.
244 the value of the environment variable if found, otherwise
245 `null` if the environment doesn't exist.
259 Assigns the given `value` to the environment variable with the given
261 If `value` is null the variable is removed from environment.
266 environment["foo"] = "bar";
270 $(OBJECTREF Exception) if the environment variable could not be added
274 On some platforms, modifying environment variables may not be allowed in
295 "Invalid environment variable name: '"~name~"'");
297 "Failed to add environment variable");
312 Removes the environment variable with the given `name`.
314 If the variable isn't in the environment, this function returns
318 On some platforms, modifying environment variables may not be allowed in
330 Identify whether a variable is defined in the environment.
339 if ("MY_ENV_FLAG" in environment)
343 if ("MY_ENV_VAR" in environment)
344 doSomething(environment["MY_ENV_VAR"]);
347 if (auto var = environment.get("MY_ENV_VAR"))
362 return true; // zero-length environment variable on Wine / XP
372 Copies all environment variables into an associative array.
375 While Windows environment variable names are case insensitive, D's
380 $(OBJECTREF Exception) if the environment variables could not
401 // In POSIX, environment variables may be defined more
405 // http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/environment-variables.html
414 enforce(envBlock, "Failed to retrieve environment variables.");
432 // Just like in POSIX systems, environment variables may be
433 // defined more than once in an environment block on Windows,
449 // Retrieves the environment variable. Calls `sink` with a
456 // first we ask windows how long the environment variable is,
465 // if the environment variable is missing, not on other errors.
499 // resize and go around again, because the environment variable grew
539 environment["std_process"] = "foo";
540 assert(environment["std_process"] == "foo");
541 assert("std_process" in environment);
544 environment["std_process"] = "b";
545 assert(environment["std_process"] == "b");
546 assert("std_process" in environment);
549 environment.remove("std_process");
550 assert("std_process" !in environment);
553 environment.remove("std_process");
554 assert("std_process" !in environment);
557 assertThrown(environment["std_process"]);
560 assert(environment.get("std_process") is null);
563 assert(environment.get("std_process", "baz") == "baz");
566 environment["std_process"] = "";
567 auto res = environment.get("std_process");
570 assert("std_process" in environment);
576 auto aa = environment.toAA();
580 // Wine has some bugs related to environment variables:
585 assert(v == environment[n]);
590 environment[n] = v;
593 auto aa2 = environment.toAA();
596 assert("std_process" in environment);
599 environment["std_process"] = null;
600 assert("std_process" !in environment);
702 directories listed in the PATH environment variable, in the order
711 $(LI The directories listed in the PATH environment variable.)
729 By default, the child process inherits the environment of the parent
731 parameter. If the same variable exists in both the parent's environment
735 process will $(I not) inherit the parent's environment. Its entire
736 environment will then be determined by `env`.
787 env = Additional environment variables for the child process.
914 // Prepare environment.
1299 // Prepare environment.
1383 // environment strings that are not present in childEnv. If the parent's
1384 // environment should be inherited without modification, this function
1390 // Determine the number of strings in the parent's environment.
1405 // Add the parent's environment.
1443 // Converts childEnv to a Windows environment block, which is on the form
1445 // those of the current process' environment strings that are not present
1446 // in childEnv. Returns null if the parent's environment should be
1467 auto parentEnv = mergeWithParentEnv ? environment.toAA() : null;
1475 // Add remaining parent environment variables.
1478 // Two final zeros are needed in case there aren't any environment vars,
1504 environment.getImpl("PATH",
1695 environment.remove("std_process_unittest1"); // Just in case.
1696 environment.remove("std_process_unittest2");
1700 environment["std_process_unittest1"] = "1";
1712 environment.remove("std_process_unittest1");
2078 By default, the child process inherits the parent's environment,
2079 and any environment variables passed to $(LREF spawnProcess) will
2081 child process' environment will be those given to spawnProcess.
2878 env = Additional environment variables for the child process.
3259 env = Additional environment variables for the child process.
3488 On Windows, this function returns the contents of the COMSPEC environment
3491 On POSIX, `userShell` returns the contents of the SHELL environment
3497 version (Windows) return environment.get("COMSPEC", nativeShell);
3498 else version (Posix) return environment.get("SHELL", nativeShell);
4167 versions of `exec` search the PATH environment variable for $(D
4169 environment variables as an array of strings of the form key=value.
4456 environment["BROWSER"] = prog.path;