mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-03 18:16:29 +00:00
fix(update): avoid Node deprecation warning on Windows spawn
This commit is contained in:
@@ -232,11 +232,13 @@ async function performNpmUpdate(
|
|||||||
console.log(info(`${isReinstall ? 'Reinstalling' : 'Updating'} via ${packageManager}...`));
|
console.log(info(`${isReinstall ? 'Reinstalling' : 'Updating'} via ${packageManager}...`));
|
||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
|
const isWindows = process.platform === 'win32';
|
||||||
|
|
||||||
const performUpdate = (): void => {
|
const performUpdate = (): void => {
|
||||||
const child = spawn(updateCommand, updateArgs, {
|
// On Windows, use shell with full command string to avoid deprecation warning
|
||||||
stdio: 'inherit',
|
const child = isWindows
|
||||||
shell: process.platform === 'win32',
|
? spawn(`${updateCommand} ${updateArgs.join(' ')}`, [], { stdio: 'inherit', shell: true })
|
||||||
});
|
: spawn(updateCommand, updateArgs, { stdio: 'inherit' });
|
||||||
|
|
||||||
child.on('exit', (code) => {
|
child.on('exit', (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
@@ -269,10 +271,10 @@ async function performNpmUpdate(
|
|||||||
|
|
||||||
if (cacheCommand && cacheArgs) {
|
if (cacheCommand && cacheArgs) {
|
||||||
console.log(info('Clearing package cache...'));
|
console.log(info('Clearing package cache...'));
|
||||||
const cacheChild = spawn(cacheCommand, cacheArgs, {
|
// On Windows, use shell with full command string to avoid deprecation warning
|
||||||
stdio: 'inherit',
|
const cacheChild = isWindows
|
||||||
shell: process.platform === 'win32',
|
? spawn(`${cacheCommand} ${cacheArgs.join(' ')}`, [], { stdio: 'inherit', shell: true })
|
||||||
});
|
: spawn(cacheCommand, cacheArgs, { stdio: 'inherit' });
|
||||||
|
|
||||||
cacheChild.on('exit', (code) => {
|
cacheChild.on('exit', (code) => {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user