Remove safeSpawnSync (unused)

This commit is contained in:
Hans Ott 2025-10-09 16:44:55 +02:00
parent 662b26a2d5
commit 0afea0eed6
2 changed files with 4 additions and 14 deletions

View file

@ -13,11 +13,6 @@ function buildCommand(command, args) {
return `${command} ${escapedArgs.join(" ")}`; return `${command} ${escapedArgs.join(" ")}`;
} }
export function safeSpawnSync(command, args, options = {}) {
const fullCommand = buildCommand(command, args);
return spawnSync(fullCommand, { ...options, shell: true });
}
export async function safeSpawn(command, args, options = {}) { export async function safeSpawn(command, args, options = {}) {
const fullCommand = buildCommand(command, args); const fullCommand = buildCommand(command, args);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View file

@ -2,7 +2,7 @@ import { describe, it, beforeEach, afterEach, mock } from "node:test";
import assert from "node:assert"; import assert from "node:assert";
describe("safeSpawn", () => { describe("safeSpawn", () => {
let safeSpawnSync, safeSpawn; let safeSpawn;
let spawnCalls = []; let spawnCalls = [];
beforeEach(async () => { beforeEach(async () => {
@ -35,7 +35,6 @@ describe("safeSpawn", () => {
// Import after mocking // Import after mocking
const safeSpawnModule = await import("./safeSpawn.js"); const safeSpawnModule = await import("./safeSpawn.js");
safeSpawnSync = safeSpawnModule.safeSpawnSync;
safeSpawn = safeSpawnModule.safeSpawn; safeSpawn = safeSpawnModule.safeSpawn;
}); });
@ -45,14 +44,10 @@ describe("safeSpawn", () => {
// Helper to run either sync or async variant // Helper to run either sync or async variant
async function runSafeSpawn(variant, command, args, options) { async function runSafeSpawn(variant, command, args, options) {
if (variant === "sync") { return await safeSpawn(command, args, options);
return safeSpawnSync(command, args, options);
} else {
return await safeSpawn(command, args, options);
}
} }
for (let variant of ["sync", "async"]) { for (let variant of ["async"]) {
it(`should pass basic command and arguments correctly (${variant})`, async () => { it(`should pass basic command and arguments correctly (${variant})`, async () => {
await runSafeSpawn(variant, "echo", ["hello"]); await runSafeSpawn(variant, "echo", ["hello"]);
@ -106,4 +101,4 @@ describe("safeSpawn", () => {
assert.strictEqual(spawnCalls[0].options.shell, true); assert.strictEqual(spawnCalls[0].options.shell, true);
}); });
} }
}); });