@@ -7,10 +7,12 @@ if (!common.hasCrypto) {
77}
88
99const assert = require ( 'node:assert' ) ;
10- const { spawnSync } = require ( 'node:child_process' ) ;
1110const diagnosticsChannel = require ( 'node:diagnostics_channel' ) ;
1211const { once } = require ( 'node:events' ) ;
1312const { Worker } = require ( 'node:worker_threads' ) ;
13+ const {
14+ spawnSyncAndExitWithoutError,
15+ } = require ( '../common/child_process' ) ;
1416const { hasFIPS, hasOpenSSL } = require ( '../common/crypto' ) ;
1517const {
1618 createHmac,
@@ -26,14 +28,10 @@ if (!hasOpenSSL(3, 4)) {
2628} else if ( ! hasFIPS ( 3 , 4 ) ) {
2729 common . skip ( 'an active OpenSSL 3.4+ FIPS provider is required' ) ;
2830} else if ( ! process . execArgv . includes ( '--enable-fips-indicator-events' ) ) {
29- const child = spawnSync (
31+ spawnSyncAndExitWithoutError (
3032 process . execPath ,
3133 [ '--enable-fips-indicator-events' , __filename ] ,
32- { encoding : 'utf8' } ) ;
33- assert . strictEqual (
34- child . status ,
35- 0 ,
36- `stdout: ${ child . stdout } \nstderr: ${ child . stderr } ` ) ;
34+ ) ;
3735} else {
3836 run ( ) . then ( common . mustCall ( ) ) ;
3937}
@@ -56,11 +54,8 @@ function nextIndicator() {
5654}
5755
5856function testUnsubscribeDuringDrain ( key , privateKey ) {
59- let resolve ;
6057 const keepAlive = setInterval ( common . mustNotCall ( ) , 10_000 ) ;
61- const promise = new Promise ( ( fulfill ) => {
62- resolve = fulfill ;
63- } ) ;
58+ const { promise, resolve } = Promise . withResolvers ( ) ;
6459 const subscriber = common . mustCall ( ( ) => {
6560 clearInterval ( keepAlive ) ;
6661 assert . strictEqual (
0 commit comments