@@ -28,10 +28,11 @@ import {
28
28
buildTimer ,
29
29
} from '@agoric/swingset-vat' ;
30
30
import { openSwingStore } from '@agoric/swing-store' ;
31
- import { connectToFakeChain } from '@agoric/cosmic-swingset/src/sim-chain.js' ;
32
31
import { makeWithQueue } from '@agoric/vats/src/queue.js' ;
32
+ import { makeShutdown } from '@agoric/cosmic-swingset/src/shutdown.js' ;
33
33
34
34
import { deliver , addDeliveryTarget } from './outbound.js' ;
35
+ import { connectToPipe } from './pipe.js' ;
35
36
import { makeHTTPListener } from './web.js' ;
36
37
37
38
import { connectToChain } from './chain-cosmos-sdk.js' ;
@@ -307,6 +308,7 @@ const deployWallet = async ({ agWallet, deploys, hostport }) => {
307
308
308
309
// We turn off NODE_OPTIONS in case the user is debugging.
309
310
const { NODE_OPTIONS : _ignore , ...noOptionsEnv } = process . env ;
311
+ let unregister ;
310
312
const cp = fork (
311
313
agoricCli ,
312
314
[
@@ -321,12 +323,11 @@ const deployWallet = async ({ agWallet, deploys, hostport }) => {
321
323
if ( err ) {
322
324
console . error ( err ) ;
323
325
}
324
- // eslint-disable-next-line no-use-before-define
325
- process . off ( 'exit' , killDeployment ) ;
326
+ unregister ( ) ;
326
327
} ,
327
328
) ;
328
- const killDeployment = ( ) => cp . kill ( 'SIGINT' ) ;
329
- process . on ( 'exit' , killDeployment ) ;
329
+ const { registerShutdown } = makeShutdown ( ) ;
330
+ unregister = registerShutdown ( ( ) => cp . kill ( 'SIGINT' ) ) ;
330
331
} ;
331
332
332
333
const start = async ( basedir , argv ) => {
@@ -421,12 +422,11 @@ const start = async (basedir, argv) => {
421
422
break ;
422
423
case 'fake-chain' : {
423
424
log ( `adding follower/sender for fake chain ${ c . GCI } ` ) ;
424
- const deliverator = await connectToFakeChain (
425
- basedir ,
426
- c . GCI ,
427
- c . fakeDelay ,
425
+ const deliverator = await connectToPipe ( {
426
+ method : 'connectToFakeChain' ,
427
+ args : [ basedir , c . GCI , c . fakeDelay ] ,
428
428
deliverInboundToMbx,
429
- ) ;
429
+ } ) ;
430
430
addDeliveryTarget ( c . GCI , deliverator ) ;
431
431
break ;
432
432
}
0 commit comments