File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 33const https = require ( 'https' ) ;
44const fs = require ( 'fs' ) ;
55const path = require ( 'path' ) ;
6- const { execSync } = require ( 'child_process' ) ;
6+ const { spawnSync } = require ( 'child_process' ) ;
77const AdmZip = require ( 'adm-zip' ) ;
88
99// Parse command line arguments
@@ -312,13 +312,17 @@ function runNpmInstall(dirPath) {
312312 // Check if current directory has package.json
313313 if ( items . includes ( 'package.json' ) ) {
314314 console . log ( `Running npm install in ${ dirPath } ...` ) ;
315- try {
316- execSync ( 'npm install' , {
317- cwd : dirPath ,
318- stdio : 'inherit'
319- } ) ;
320- } catch ( err ) {
321- console . error ( `Warning: npm install failed in ${ dirPath } ` ) ;
315+ // Use spawnSync instead of execSync to have better control over exit codes
316+ // npm returns exit code 1 for vulnerabilities, which shouldn't fail the script
317+ const result = spawnSync ( 'npm' , [ 'install' ] , {
318+ cwd : dirPath ,
319+ stdio : 'inherit' ,
320+ shell : true
321+ } ) ;
322+
323+ // Only warn on actual failures (exit codes > 1), not on vulnerabilities (exit code 1)
324+ if ( result . status !== null && result . status > 1 ) {
325+ console . error ( `Warning: npm install failed in ${ dirPath } with exit code ${ result . status } ` ) ;
322326 }
323327 }
324328
You can’t perform that action at this time.
0 commit comments