Skip to content

Commit

Permalink
asd2
Browse files Browse the repository at this point in the history
  • Loading branch information
drinkalotz committed Nov 29, 2024
1 parent f48a673 commit 75ff3e3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ const currentVersion = parseInt(process.version.slice(1).split('.')[0]);

const commander = getCommander();
const command = process.argv[2] ?? '';
const npxPath = !isWin() ? execSync('which npx').toString().trim() : null;
const npxPath = isWin() ? execSync('where npx').toString().trim() : execSync('which npx').toString().trim();
if (command) {
getLogMessageInline(`Starting ${command} command...`, 'cyan');
}
if (currentVersion < MIN_VERSION) {
const scriptPath = path.join(process.cwd(), 'src', 'app.js');
const npxProcess = spawn(
!isWin() ? npxPath : 'npx',
['-p', `node@${MIN_VERSION}`, 'node', scriptPath, ...process.argv.slice(2)],
{
stdio: 'overlapped',
}
);
const npxProcess = spawn(npxPath, ['-p', `node@${MIN_VERSION}`, 'node', scriptPath, ...process.argv.slice(2)], {
stdio: 'inherit',
});

npxProcess.on('exit', (code) => {
process.exit(code);
Expand Down

0 comments on commit 75ff3e3

Please sign in to comment.