Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions scripts/run-with-pm.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Usage: node scripts/run-with-pm.js <command>
*/

const { execSync } = require("child_process");
const { execSync, execFileSync } = require("child_process");

function detectPackageManager() {
try {
Expand All @@ -22,15 +22,18 @@
}

const pm = detectPackageManager();
const command = process.argv.slice(2).join(" ");
const argv = process.argv.slice(2);

if (!command) {
if (argv.length === 0) {

Check failure

Code scanning / CodeQL

User-controlled bypass of security check High

This condition guards a sensitive
action
, but a
user-provided value
controls it.
console.error("Error: No command provided");
process.exit(1);
}

const subcommand = argv[0];
const args = argv.slice(1);

try {
execSync(`${pm} ${command}`, { stdio: "inherit" });
execFileSync(pm, [subcommand, ...args], { stdio: "inherit" });
} catch (error) {
process.exit(error.status || 1);
}