@@ -2,7 +2,7 @@ import "./side-effects"; // doesn't quite work for silencing the bigint error me
2
2
import evm from "@wormhole-foundation/sdk/platforms/evm" ;
3
3
import solana from "@wormhole-foundation/sdk/platforms/solana" ;
4
4
import { encoding } from '@wormhole-foundation/sdk-connect' ;
5
- import { execSync } from "child_process" ;
5
+ import { execSync , spawn } from "child_process" ;
6
6
7
7
import evmDeployFile from "../../evm/script/DeployWormholeNtt.s.sol" with { type : "file" } ;
8
8
import evmDeployFileHelper from "../../evm/script/helpers/DeployWormholeNttBase.sol" with { type : "file" } ;
@@ -1349,20 +1349,26 @@ async function deploySolana<N extends Network, C extends SolanaChains>(
1349
1349
// build the program
1350
1350
// TODO: build with docker
1351
1351
checkAnchorVersion ( ) ;
1352
- const proc = Bun . spawn (
1352
+ const proc = spawn (
1353
1353
[ "anchor" ,
1354
1354
"build" ,
1355
1355
"-p" , "example_native_token_transfers" ,
1356
1356
"--" , "--no-default-features" , "--features" , cargoNetworkFeature ( ch . network )
1357
- ] , {
1357
+ ] . join ( " " ) , {
1358
1358
cwd : `${ pwd } /solana`
1359
1359
} ) ;
1360
1360
1361
1361
// const _out = await new Response(proc.stdout).text();
1362
-
1363
- await proc . exited ;
1364
- if ( proc . exitCode !== 0 ) {
1365
- process . exit ( proc . exitCode ?? 1 ) ;
1362
+ const buildProcExitCode = await new Promise < number | null > ( ( resolve ) => {
1363
+ proc . on ( 'exit' , ( code ) => {
1364
+ resolve ( code ) ;
1365
+ } )
1366
+ proc . on ( 'close' , ( code ) => {
1367
+ resolve ( code ) ;
1368
+ } )
1369
+ } )
1370
+ if ( buildProcExitCode !== 0 ) {
1371
+ process . exit ( buildProcExitCode ?? 1 ) ;
1366
1372
}
1367
1373
1368
1374
binary = `${ pwd } /solana/target/deploy/example_native_token_transfers.so` ;
@@ -1395,14 +1401,20 @@ async function deploySolana<N extends Network, C extends SolanaChains>(
1395
1401
deployCommand . push ( "--with-compute-unit-price" , priorityFee . toString ( ) ) ;
1396
1402
}
1397
1403
1398
- const deployProc = Bun . spawn ( deployCommand ) ;
1404
+ const deployProc = spawn ( deployCommand . join ( " " ) ) ;
1399
1405
1400
1406
const out = await new Response ( deployProc . stdout ) . text ( ) ;
1407
+ const deployProcExitCode = await new Promise < number | null > ( ( resolve ) => {
1408
+ deployProc . on ( 'exit' , ( code ) => {
1409
+ resolve ( code ) ;
1410
+ } )
1411
+ deployProc . on ( 'close' , ( code ) => {
1412
+ resolve ( code ) ;
1413
+ } )
1414
+ } )
1401
1415
1402
- await deployProc . exited ;
1403
-
1404
- if ( deployProc . exitCode !== 0 ) {
1405
- process . exit ( deployProc . exitCode ?? 1 ) ;
1416
+ if ( deployProcExitCode !== 0 ) {
1417
+ process . exit ( deployProcExitCode ?? 1 ) ;
1406
1418
}
1407
1419
1408
1420
// success. remove buffer.json
@@ -1705,7 +1717,7 @@ async function pullChainConfig<N extends Network, C extends Chain>(
1705
1717
const nativeManagerAddress = canonicalAddress ( manager ) ;
1706
1718
1707
1719
const { ntt, addresses } : { ntt : Ntt < N , C > ; addresses : Partial < Ntt . Contracts > ; } =
1708
- await nttFromManager < N , C > ( ch , nativeManagerAddress ) ;
1720
+ await nttFromManager < N , C > ( ch , nativeManagerAddress ) ;
1709
1721
1710
1722
const mode = await ntt . getMode ( ) ;
1711
1723
const outboundLimit = await ntt . getOutboundLimit ( ) ;
0 commit comments