diff options
author | 2023-07-11 19:14:34 -0700 | |
---|---|---|
committer | 2023-07-11 19:14:34 -0700 | |
commit | cbb88672f217a90db1aa1eb29cd92d5d9035b22b (patch) | |
tree | 43a00501f3cde495967e116f0b660777051551f8 /src/js/out/modules/node/os.js | |
parent | 1f900cff453700b19bca2acadfe26da4468c1282 (diff) | |
parent | 34b0e7a2bbd8bf8097341cdb0075d0908283e834 (diff) | |
download | bun-jarred/esm-conditions.tar.gz bun-jarred/esm-conditions.tar.zst bun-jarred/esm-conditions.zip |
Merge branch 'main' into jarred/esm-conditionsjarred/esm-conditions
Diffstat (limited to 'src/js/out/modules/node/os.js')
-rw-r--r-- | src/js/out/modules/node/os.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/js/out/modules/node/os.js b/src/js/out/modules/node/os.js index e27464e15..9bcf1d733 100644 --- a/src/js/out/modules/node/os.js +++ b/src/js/out/modules/node/os.js @@ -12,7 +12,9 @@ var bound = function(obj) { platform: obj.platform.bind(obj), release: obj.release.bind(obj), setPriority: obj.setPriority.bind(obj), - tmpdir: obj.tmpdir.bind(obj), + get tmpdir() { + return tmpdir; + }, totalmem: obj.totalmem.bind(obj), type: obj.type.bind(obj), uptime: obj.uptime.bind(obj), @@ -24,6 +26,15 @@ var bound = function(obj) { constants: obj.constants, [Symbol.for("CommonJS")]: 0 }; +}, tmpdir = function() { + var lazy = Symbol.for("Bun.lazy"), primordials = globalThis[lazy]("primordials"), { Bun: Bun2 } = primordials, env = Bun2.env; + return tmpdir = function() { + var path = env.TMPDIR || env.TMP || env.TEMP || "/tmp"; + const length = path.length; + if (length > 1 && path[length - 1] === "/") + path = path.slice(0, -1); + return path; + }, tmpdir(); }, os = bound(Bun._Os()), { arch, cpus, @@ -37,7 +48,6 @@ var bound = function(obj) { platform, release, setPriority, - tmpdir, totalmem, type, uptime, |