@@ -14,28 +14,15 @@ 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 ( "/bin/sh" , [ scriptPath , ZMQ , ARCH ] , {
18+ stdio : [ 'inherit' , 'inherit' , 'inherit' ] ,
19+ } ) ;
20+ if ( ! child . status ) {
21+ return console . error ( "child process exited with code " + child . status ) ;
3222 }
23+
3324 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- } ;
25+ fs . writeFileSync ( path . join ( zmqDir , "BUILD_SUCCESS" ) , message )
3926}
4027
4128function handleError ( err ) {
@@ -106,6 +93,10 @@ if (process.platform === "win32") {
10693 if ( err ) {
10794 handleError ( err ) ;
10895 }
109- buildZMQ ( SCRIPT_PATH , DIR_NAME ) ;
96+ try {
97+ buildZMQ ( SCRIPT_PATH , DIR_NAME ) ;
98+ } catch ( err ) {
99+ handleError ( err ) ;
100+ }
110101 } ) ;
111102}
0 commit comments