2023-06-22 14:21:42 +00:00
|
|
|
const cp = require('node:child_process');
|
|
|
|
const fs = require('node:fs');
|
2020-08-07 21:13:09 +00:00
|
|
|
|
|
|
|
const checkPath = process.argv[2];
|
|
|
|
const command = process.argv.slice(3);
|
|
|
|
|
|
|
|
if (fs.existsSync(checkPath)) {
|
|
|
|
const child = cp.spawn(
|
|
|
|
`${command[0]}${process.platform === 'win32' ? '.cmd' : ''}`,
|
|
|
|
command.slice(1),
|
|
|
|
{
|
|
|
|
stdio: 'inherit',
|
2024-04-19 13:27:58 +00:00
|
|
|
cwd: checkPath,
|
|
|
|
shell: process.platform === 'win32'
|
2020-08-07 21:13:09 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
child.on('exit', code => process.exit(code));
|
|
|
|
}
|