1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
denoland-deno/cli/tests/testdata/lock_write_fetch.ts
Nayeem Rahman 45c49034a7
BREAKING(unstable): Improve Deno.spawn() stdio API (#14919)
- "SpawnOutput" extends "ChildStatus" instead of composing it
- "SpawnOutput::stdout", "SpawnOutput::stderr", "Child::stdin", 
"Child::stdout" and "Child::stderr" are no longer optional, instead 
made them getters that throw at runtime if that stream wasn't set 
to "piped". 
- Remove the complicated "<T extends SpawnOptions = SpawnOptions>" 
which we currently need to give proper type hints for the availability of 
these fields. Their typings for these would get increasingly complex 
if it became dependent on more options (e.g. "SpawnOptions::pty" 
which if set should make the stdio streams unavailable)
2022-07-18 15:16:12 +02:00

52 lines
1,021 B
TypeScript

try {
Deno.removeSync("./lock_write_fetch.json");
} catch {
// pass
}
const fetchProc = await Deno.spawn(Deno.execPath(), {
stdout: "null",
stderr: "null",
args: [
"cache",
"--reload",
"--lock=lock_write_fetch.json",
"--lock-write",
"--cert=tls/RootCA.pem",
"https_import.ts",
],
});
console.log(`fetch code: ${fetchProc.code}`);
const fetchCheckProc = await Deno.spawn(Deno.execPath(), {
stdout: "null",
stderr: "null",
args: [
"cache",
"--lock=lock_write_fetch.json",
"--cert=tls/RootCA.pem",
"https_import.ts",
],
});
console.log(`fetch check code: ${fetchCheckProc.code}`);
Deno.removeSync("./lock_write_fetch.json");
const runProc = await Deno.spawn(Deno.execPath(), {
stdout: "null",
stderr: "null",
args: [
"run",
"--lock=lock_write_fetch.json",
"--lock-write",
"--allow-read",
"file_exists.ts",
"lock_write_fetch.json",
],
});
console.log(`run code: ${runProc.code}`);
Deno.removeSync("./lock_write_fetch.json");