mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-17 08:17:22 +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:
@@ -207,14 +207,27 @@ async function performNpmUpdate(
|
||||
const performUpdate = (): void => {
|
||||
// On Windows, use shell with full command string to avoid deprecation warning
|
||||
// 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
|
||||
? spawn(`${updateCommand} ${updateArgs.join(' ')}`, [], {
|
||||
stdio: 'inherit',
|
||||
stdio: ['inherit', 'inherit', 'pipe'],
|
||||
shell: true,
|
||||
env: { ...process.env, NODE_NO_WARNINGS: '1' },
|
||||
})
|
||||
: 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) => {
|
||||
if (code === 0) {
|
||||
console.log('');
|
||||
|
||||
Reference in New Issue
Block a user