@@ -14,28 +14,16 @@ if (process.env.npm_config_zmq_external == "true") {
1414
1515function buildZMQ ( scriptPath , zmqDir ) {
1616 console . log ( "Building libzmq for " + process . platform ) ;
17- try {
18- const child = spawnSync ( scriptPath , [ ZMQ , ARCH ] , {
19- cwd : process . cwd ( ) ,
20- env : process . env ,
21- stdio : [ 'inherit' , 'inherit' , 'pipe' ] ,
22- encoding : 'utf-8' ,
23- } ) ;
24- if ( child . stderr ) {
25- return console . log ( Error ( child . stderr ) )
26- }
27- if ( child . status !== 0 ) {
28- return console . error ( "child process exited with code " + child . status ) ;
29- }
30- } catch ( e ) {
31- return console . error ( e )
17+ const child = spawnSync ( scriptPath , [ ZMQ , ARCH ] , {
18+ shell : true ,
19+ stdio : [ 'inherit' , 'inherit' , 'inherit' ] ,
20+ } ) ;
21+ if ( ! child . status ) {
22+ return console . error ( "child process exited with code " + child . status ) ;
3223 }
24+
3325 const message = "Succesfully build libzmq on " + Date ( ) ;
34- try {
35- fs . writeFileSync ( path . join ( zmqDir , "BUILD_SUCCESS" ) , message )
36- } catch ( err ) {
37- console . error ( err . message ) ;
38- } ;
26+ fs . writeFileSync ( path . join ( zmqDir , "BUILD_SUCCESS" ) , message )
3927}
4028
4129function handleError ( err ) {
@@ -106,6 +94,10 @@ if (process.platform === "win32") {
10694 if ( err ) {
10795 handleError ( err ) ;
10896 }
109- buildZMQ ( SCRIPT_PATH , DIR_NAME ) ;
97+ try {
98+ buildZMQ ( SCRIPT_PATH , DIR_NAME ) ;
99+ } catch ( err ) {
100+ handleError ( err ) ;
101+ }
110102 } ) ;
111103}
0 commit comments