@@ -14,13 +14,9 @@ const realDirname = path.dirname(realFilename)
1414const npmPath = installLinks ( path . join ( realDirname , 'bin' ) , 'npm' )
1515const injectionPath = path . join ( realDirname , 'npm-injection.js' )
1616
17- process . exitCode = 1
18-
19- /*
20- Adding the `--quiet` and `--no-progress` flags when the `proc-log` module
21- is found to fix a UX issue when running the command with recent versions of npm
22- (input swallowed by the standard npm spinner)
23- */
17+ // Adding the `--quiet` and `--no-progress` flags when the `proc-log` module
18+ // is found to fix a UX issue when running the command with recent versions of
19+ // npm (input swallowed by the standard npm spinner)
2420let npmArgs : string [ ] = [ ]
2521if ( process . argv . slice ( 2 ) . includes ( 'install' ) ) {
2622 const npmEntrypoint = realpathSync ( npmPath )
@@ -29,7 +25,6 @@ if (process.argv.slice(2).includes('install')) {
2925 process . exit ( 127 )
3026 }
3127 const npmDepPath = path . join ( npmRootPath , 'node_modules' )
32-
3328 let npmlog
3429 try {
3530 npmlog = require ( path . join ( npmDepPath , 'proc-log/lib/index.js' ) ) . log
@@ -39,16 +34,19 @@ if (process.argv.slice(2).includes('install')) {
3934 }
4035}
4136
42- spawn (
37+ process . exitCode = 1
38+ const spawnPromise = spawn (
4339 process . execPath ,
4440 [ '--require' , injectionPath , npmPath , ...process . argv . slice ( 2 ) , ...npmArgs ] ,
4541 {
4642 stdio : 'inherit'
4743 }
48- ) . process . on ( 'exit' , ( code , signal ) => {
44+ )
45+ spawnPromise . process . on ( 'exit' , ( code , signal ) => {
4946 if ( signal ) {
5047 process . kill ( process . pid , signal )
5148 } else if ( code !== null ) {
5249 process . exit ( code )
5350 }
5451} )
52+ void spawnPromise
0 commit comments