@@ -109,16 +109,17 @@ describe('daemon', () => {
109
109
await ipfs ( 'config' , 'Addresses.API' , JSON . stringify ( apiAddrs ) , '--json' )
110
110
await ipfs ( 'config' , 'Addresses.Gateway' , JSON . stringify ( gatewayAddrs ) , '--json' )
111
111
112
- const out = await new Promise ( resolve => {
112
+ const out = await new Promise ( ( resolve , reject ) => {
113
113
const res = ipfs ( 'daemon' )
114
114
let out = ''
115
115
116
116
res . stdout . on ( 'data' , function onData ( data ) {
117
117
out += data
118
118
if ( out . includes ( 'Daemon is ready' ) ) {
119
119
res . stdout . removeListener ( 'data' , onData )
120
+ const onKilled = ( ) => resolve ( out )
121
+ res . then ( onKilled ) . catch ( onKilled )
120
122
res . kill ( )
121
- resolve ( out )
122
123
}
123
124
} )
124
125
} )
@@ -134,16 +135,17 @@ describe('daemon', () => {
134
135
await ipfs ( 'config' , 'Addresses.API' , '[]' , '--json' )
135
136
await ipfs ( 'config' , 'Addresses.Gateway' , '[]' , '--json' )
136
137
137
- const out = await new Promise ( resolve => {
138
+ const out = await new Promise ( ( resolve , reject ) => {
138
139
const res = ipfs ( 'daemon' )
139
140
let out = ''
140
141
141
142
res . stdout . on ( 'data' , function onData ( data ) {
142
143
out += data
143
144
if ( out . includes ( 'Daemon is ready' ) ) {
144
145
res . stdout . removeListener ( 'data' , onData )
146
+ const onKilled = ( ) => resolve ( out )
147
+ res . then ( onKilled ) . catch ( onKilled )
145
148
res . kill ( )
146
- resolve ( out )
147
149
}
148
150
} )
149
151
} )
0 commit comments