1- import { execSync } from 'child_process ' ;
1+ import { execaSync } from 'execa ' ;
22
33function testRe2 ( ) {
4- execSync (
5- `node -e "try{require('re2')('.*').exec('test')}catch(e){console.error(e);if(e.code === 'ERR_DLOPEN_FAILED' && e.message.includes('NODE_MODULE_VERSION')) process.exit(1); else process.exit(-1)}"` ,
4+ execaSync (
5+ 'node' ,
6+ [
7+ '-e' ,
8+ `try{require('re2')('.*').exec('test')}catch(e){console.error(e);if(e.code === 'ERR_DLOPEN_FAILED' && e.message.includes('NODE_MODULE_VERSION')) process.exit(1); else process.exit(-1)}` ,
9+ ] ,
610 { stdio : 'inherit' } ,
711 ) ;
812 console . log ( `Ok.` ) ;
913}
1014
1115function testSqlite ( ) {
12- execSync (
13- `node -e "try{new require('better-sqlite3')(':memory:')}catch(e){console.error(e);if(e.code === 'ERR_DLOPEN_FAILED' && e.message.includes('NODE_MODULE_VERSION')) process.exit(1); else process.exit(-1)}"` ,
16+ execaSync (
17+ 'node' ,
18+ [
19+ '-e' ,
20+ `try{new require('better-sqlite3')(':memory:')}catch(e){console.error(e);if(e.code === 'ERR_DLOPEN_FAILED' && e.message.includes('NODE_MODULE_VERSION')) process.exit(1); else process.exit(-1)}` ,
21+ ] ,
1422 { stdio : 'inherit' } ,
1523 ) ;
1624 console . log ( `Ok.` ) ;
@@ -23,9 +31,9 @@ function testSqlite() {
2331 } catch ( e ) {
2432 console . error ( `Failed.\n${ e } ` ) ;
2533 try {
26- if ( e . status === 1 ) {
34+ if ( e . exitCode === 1 ) {
2735 console . log ( `Retry re2 install ...` ) ;
28- execSync ( 'pnpm rb re2' , {
36+ execaSync ( 'pnpm' , [ 'rb' , ' re2'] , {
2937 stdio : 'inherit' ,
3038 } ) ;
3139 testRe2 ( ) ;
@@ -46,9 +54,9 @@ function testSqlite() {
4654 } catch ( e ) {
4755 console . error ( `Failed.\n${ e } ` ) ;
4856 try {
49- if ( e . status === 1 ) {
57+ if ( e . exitCode === 1 ) {
5058 console . log ( `Retry better-sqlite3 install ...` ) ;
51- execSync ( 'pnpm rb better-sqlite3' , {
59+ execaSync ( 'pnpm' , [ 'rb' , ' better-sqlite3'] , {
5260 stdio : 'inherit' ,
5361 } ) ;
5462 testSqlite ( ) ;
0 commit comments