mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-10-19 05:57:31 +02:00
chore: fix node deprecation warning
This commit is contained in:
1 parent
f930da1a67
commit
5217d7970c
1 file changed
+9
-5
@@ -1,4 +1,4 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { execFileSync, execSync } from "node:child_process";
|
||||
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@@ -156,14 +156,18 @@ function commandOutput(command, args) {
|
||||
// spawn batch files without a shell (CVE-2024-27980), so `execFileSync`
|
||||
// fails with EINVAL there. Every argument below is a literal from this file,
|
||||
// so routing that one call through cmd.exe interpolates nothing.
|
||||
const needsShell = process.platform === "win32" && command === "pnpm";
|
||||
return execFileSync(needsShell ? "pnpm.cmd" : command, args, {
|
||||
// One command string rather than an argument list: Node deprecates
|
||||
// passing arguments alongside `shell: true` (DEP0190).
|
||||
const options = {
|
||||
cwd: PROJECT_ROOT,
|
||||
encoding: "utf8",
|
||||
maxBuffer: MAX_COMMAND_OUTPUT,
|
||||
shell: needsShell,
|
||||
windowsHide: true,
|
||||
});
|
||||
};
|
||||
if (process.platform === "win32" && command === "pnpm") {
|
||||
return execSync(["pnpm.cmd", ...args].join(" "), options);
|
||||
}
|
||||
return execFileSync(command, args, options);
|
||||
}
|
||||
|
||||
function generateInventory() {
|
||||
|
||||
Reference in new issue
Block a user