mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Remove safeSpawnSync (unused)
This commit is contained in:
parent
662b26a2d5
commit
0afea0eed6
2 changed files with 4 additions and 14 deletions
|
|
@ -13,11 +13,6 @@ function buildCommand(command, args) {
|
|||
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 = {}) {
|
||||
const fullCommand = buildCommand(command, args);
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { describe, it, beforeEach, afterEach, mock } from "node:test";
|
|||
import assert from "node:assert";
|
||||
|
||||
describe("safeSpawn", () => {
|
||||
let safeSpawnSync, safeSpawn;
|
||||
let safeSpawn;
|
||||
let spawnCalls = [];
|
||||
|
||||
beforeEach(async () => {
|
||||
|
|
@ -35,7 +35,6 @@ describe("safeSpawn", () => {
|
|||
|
||||
// Import after mocking
|
||||
const safeSpawnModule = await import("./safeSpawn.js");
|
||||
safeSpawnSync = safeSpawnModule.safeSpawnSync;
|
||||
safeSpawn = safeSpawnModule.safeSpawn;
|
||||
});
|
||||
|
||||
|
|
@ -45,14 +44,10 @@ describe("safeSpawn", () => {
|
|||
|
||||
// Helper to run either sync or async variant
|
||||
async function runSafeSpawn(variant, command, args, options) {
|
||||
if (variant === "sync") {
|
||||
return safeSpawnSync(command, args, options);
|
||||
} else {
|
||||
return await safeSpawn(command, args, options);
|
||||
}
|
||||
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 () => {
|
||||
await runSafeSpawn(variant, "echo", ["hello"]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue