mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 00:14:15 +00:00
fix(update): filter npm cleanup warnings on Windows
Filter cosmetic EPERM warnings during update on Windows when npm fails to unlink native module prebuilds (bcrypt.node) due to file locking by antivirus/indexing services. Update still succeeds - warnings are noise. Closes #405
This commit is contained in:
1 parent
bd89cabc8a
commit
c9f8ed1a04
1 file changed
+14
-1
@@ -207,14 +207,27 @@ async function performNpmUpdate(
|
|||||||
const performUpdate = (): void => {
|
const performUpdate = (): void => {
|
||||||
// On Windows, use shell with full command string to avoid deprecation warning
|
// On Windows, use shell with full command string to avoid deprecation warning
|
||||||
// Also suppress Node deprecation warnings that may come from package managers
|
// Also suppress Node deprecation warnings that may come from package managers
|
||||||
|
// Pipe stderr on Windows to filter npm cleanup warnings (EPERM on native modules)
|
||||||
const child = isWindows
|
const child = isWindows
|
||||||
? spawn(`${updateCommand} ${updateArgs.join(' ')}`, [], {
|
? spawn(`${updateCommand} ${updateArgs.join(' ')}`, [], {
|
||||||
stdio: 'inherit',
|
stdio: ['inherit', 'inherit', 'pipe'],
|
||||||
shell: true,
|
shell: true,
|
||||||
env: { ...process.env, NODE_NO_WARNINGS: '1' },
|
env: { ...process.env, NODE_NO_WARNINGS: '1' },
|
||||||
})
|
})
|
||||||
: spawn(updateCommand, updateArgs, { stdio: 'inherit' });
|
: spawn(updateCommand, updateArgs, { stdio: 'inherit' });
|
||||||
|
|
||||||
|
// On Windows, filter stderr to hide npm cleanup warnings (EPERM on bcrypt.node etc.)
|
||||||
|
// These warnings are cosmetic - update succeeds despite file locking by antivirus/indexing
|
||||||
|
if (isWindows && child.stderr) {
|
||||||
|
child.stderr.on('data', (data: Buffer) => {
|
||||||
|
const output = data.toString();
|
||||||
|
// Skip npm cleanup warnings (EPERM, ENOTEMPTY, EBUSY on native module prebuilds)
|
||||||
|
if (!/npm warn cleanup/i.test(output)) {
|
||||||
|
process.stderr.write(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
child.on('exit', (code) => {
|
child.on('exit', (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
console.log('');
|
console.log('');
|
||||||
|
|||||||
Reference in new issue
Block a user