summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/sys.js
blob: db7af47dab2fa1249edc9772f50f9545e65e780b (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
/**
 * AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
 **/
function node() {
  const { existsSync } = require('fs');

  return {
    type: 'node',
    existsSync,
    args: process.argv.slice(2),
    cwd: () => process.cwd(),
    exit: code => process.exit(code),
  };
}

function deno() {
  function existsSync(path) {
    try {
      Deno.readFileSync(path);
      return true;
    } catch (err) {
      return false;
    }
  }

  return {
    type: 'deno',
    existsSync,
    args: Deno.args,
    cwd: Deno.cwd,
    exit: Deno.exit,
  };
}

const sys = typeof globalThis.process !== 'undefined' ? node() : deno();

export default sys;