Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return pathExists(dirPath).then(exists => {
if (!exists) {
return;
}
// globs only return directories with a trailing slash
const slashed = path.normalize(`${dirPath}/`);
const args = [RIMRAF_CLI, "--no-glob", slashed];
// We call this resolved CLI path in the "path/to/node path/to/cli <..args>"
// pattern to avoid Windows hangups with shebangs (e.g., WSH can't handle it)
return ChildProcessUtilities.spawn(process.execPath, args).then(() => {
log.verbose("rimrafDir", "removed", dirPath);
return dirPath;
});
});
}
return pathExists(dirPath).then(exists => {
if (!exists) {
return;
}
// globs only return directories with a trailing slash
const slashed = path.normalize(`${dirPath}/`);
const args = [RIMRAF_CLI, "--no-glob", slashed];
// We call this resolved CLI path in the "path/to/node path/to/cli <..args>"
// pattern to avoid Windows hangups with shebangs (e.g., WSH can't handle it)
return ChildProcessUtilities.spawn(process.execPath, args).then(() => {
log.verbose("rimrafDir", "removed", dirPath);
return dirPath;
});
});
}
execute() {
return ChildProcessUtilities.spawn("git", this.args, this.execOpts).catch(err => {
if (err.code) {
// quitting the diff viewer is not an error
throw err;
}
});
}
}
function runBenchmarks() {
const outputFile = process.argv[2]
const lernaProcess = spawn('lerna', ['run', 'bench', '--stream'])
lernaProcess.on('exit', code => {
if (code !== 0) {
process.exit(code)
}
})
lernaProcess.on('close', async () => {
try {
const results = await getAllBenchmarkResults()
if (results.length === 0) {
console.warn('No benchmarks results found', 'Skipping this run')
process.exit(1)
}
const gitlog = execSync('git', [
'log',
'-1',
'--pretty=%h,%s',
runCommandInPackageCapturing(pkg) {
return ChildProcessUtilities.spawn(this.command, this.args, this.getOpts(pkg));
}
}