summaryrefslogtreecommitdiff
path: root/tests/testdata/run/lock_write_fetch/main.ts
blob: 4ce631311925378cb5916a50ac89249607850021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
try {
  Deno.removeSync("./lock_write_fetch.json");
} catch {
  // pass
}

const fetchProc = await new Deno.Command(Deno.execPath(), {
  stdout: "null",
  stderr: "null",
  args: [
    "cache",
    "--reload",
    "--lock=lock_write_fetch.json",
    "--cert=tls/RootCA.pem",
    "run/https_import.ts",
  ],
}).output();

console.log(`fetch code: ${fetchProc.code}`);

const fetchCheckProc = await new Deno.Command(Deno.execPath(), {
  stdout: "null",
  stderr: "null",
  args: [
    "cache",
    "--lock=lock_write_fetch.json",
    "--cert=tls/RootCA.pem",
    "run/https_import.ts",
  ],
}).output();

console.log(`fetch check code: ${fetchCheckProc.code}`);

Deno.removeSync("./lock_write_fetch.json");

const runProc = await new Deno.Command(Deno.execPath(), {
  stdout: "null",
  stderr: "null",
  args: [
    "run",
    "--lock=lock_write_fetch.json",
    "--allow-read",
    "--cert=tls/RootCA.pem",
    "run/https_import.ts",
  ],
}).output();

console.log(`run code: ${runProc.code}`);

await Deno.stat("./lock_write_fetch.json");
Deno.removeSync("./lock_write_fetch.json");