Bug 1377180: Pass PATH environment variables with partial environment on Windows. r=aswan

MozReview-Commit-ID: JwqvmHJpFcL

--HG--
extra : rebase_source : 6d6acb4cbee0a5cf5d5e45f879c6efb1f46819f2
extra : amend_source : a7762c101531632e34ad1a4cb606202103ee888f
This commit is contained in:
Kris Maglione 2017-06-29 11:50:39 -07:00
Родитель 1eea60e47d
Коммит 510b6f7b72
1 изменённых файлов: 28 добавлений и 18 удалений

Просмотреть файл

@ -658,28 +658,38 @@ add_task(async function test_subprocess_arguments() {
});
// Windows XP can't handle launching Python with a partial environment.
if (!AppConstants.isPlatformAndVersionAtMost("win", "5.2")) {
add_task(async function test_subprocess_environment() {
let proc = await Subprocess.call({
command: PYTHON,
arguments: ["-u", TEST_SCRIPT, "env", "PATH", "FOO"],
environment: {
FOO: "BAR",
},
add_task(async function test_subprocess_environment() {
let environment = {
FOO: "BAR",
};
// Our Windows environment can't handle launching python without
// PATH variables.
if (AppConstants.platform == "win") {
Object.assign(environment, {
PATH: env.get("PATH"),
PATHEXT: env.get("PATHEXT"),
});
}
let path = await read(proc.stdout);
let foo = await read(proc.stdout);
env.set("BAR", "BAZ");
equal(path, "", "Got expected $PATH value");
equal(foo, "BAR", "Got expected $FOO value");
let {exitCode} = await proc.wait();
equal(exitCode, 0, "Got expected exit code");
let proc = await Subprocess.call({
command: PYTHON,
arguments: ["-u", TEST_SCRIPT, "env", "FOO", "BAR"],
environment,
});
}
let foo = await read(proc.stdout);
let bar = await read(proc.stdout);
equal(foo, "BAR", "Got expected $FOO value");
equal(bar, "", "Got expected $BAR value");
let {exitCode} = await proc.wait();
equal(exitCode, 0, "Got expected exit code");
});
add_task(async function test_subprocess_environmentAppend() {