From d398d58b18735629802ab6177ed8d334eb3ccc00 Mon Sep 17 00:00:00 2001 From: Zeroday BYTE Date: Sun, 22 Jun 2025 14:45:02 +0700 Subject: [PATCH] Update benchmark.js --- benchmark/benchmark.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js index 9288d1f273..e6be9d3d09 100644 --- a/benchmark/benchmark.js +++ b/benchmark/benchmark.js @@ -29,8 +29,8 @@ function localDir(...paths) { return path.join(__dirname, '..', ...paths); } -function exec(command, options = {}) { - const result = cp.execSync(command, { +function exec(command, args = [], options = {}) { + const result = cp.execFileSync(command, args, { encoding: 'utf-8', stdio: ['inherit', 'pipe', 'inherit'], ...options, @@ -62,7 +62,7 @@ function prepareBenchmarkProjects(revisionList) { 'npm --quiet install --ignore-scripts ' + prepareNPMPackage(revision), { cwd: projectPath }, ); - exec(`cp -R ${localDir('benchmark')} ${projectPath}`); + exec('cp', ['-R', localDir('benchmark'), projectPath]); return { revision, projectPath }; }); @@ -76,7 +76,7 @@ function prepareBenchmarkProjects(revisionList) { } // Returns the complete git hash for a given git revision reference. - const hash = exec(`git rev-parse "${revision}"`); + const hash = exec('git', ['rev-parse', revision]); const archivePath = path.join(tmpDir, `graphql-${hash}.tgz`); if (fs.existsSync(archivePath)) { @@ -86,8 +86,8 @@ function prepareBenchmarkProjects(revisionList) { const repoDir = path.join(tmpDir, hash); fs.rmSync(repoDir, { recursive: true, force: true }); fs.mkdirSync(repoDir); - exec(`git archive "${hash}" | tar -xC "${repoDir}"`); - exec('npm --quiet ci --ignore-scripts', { cwd: repoDir }); + exec('sh', ['-c', `git archive "${hash}" | tar -xC "${repoDir}"`]); + exec('npm', ['--quiet', 'ci', '--ignore-scripts'], { cwd: repoDir }); fs.renameSync(buildNPMArchive(repoDir), archivePath); fs.rmSync(repoDir, { recursive: true }); return archivePath;