File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Changes
2
2
3
+ ## v3.3
4
+
5
+ - Include ` watchdogPid ` as a metadata argument to cleanup
6
+ function
7
+
3
8
## v3.2
4
9
5
10
- Export ` watchdog ` and ` proxySignals ` functionality
Original file line number Diff line number Diff line change 4
4
Serializable ,
5
5
spawn as nodeSpawn ,
6
6
SpawnOptions ,
7
+ ChildProcess ,
7
8
} from 'child_process'
8
9
import crossSpawn from 'cross-spawn'
9
10
import { onExit } from 'signal-exit'
@@ -37,6 +38,9 @@ const spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn
37
38
export type Cleanup = (
38
39
code : number | null ,
39
40
signal : null | NodeJS . Signals ,
41
+ processInfo : {
42
+ watchdogPid : ChildProcess [ 'pid' ]
43
+ } ,
40
44
) =>
41
45
| void
42
46
| undefined
@@ -159,15 +163,17 @@ export function foregroundChild(
159
163
const removeOnExit = onExit ( childHangup )
160
164
161
165
proxySignals ( child )
162
- watchdog ( child )
166
+ const dog = watchdog ( child )
163
167
164
168
let done = false
165
169
child . on ( 'close' , async ( code , signal ) => {
166
170
/* c8 ignore start */
167
171
if ( done ) return
168
172
/* c8 ignore stop */
169
173
done = true
170
- const result = cleanup ( code , signal )
174
+ const result = cleanup ( code , signal , {
175
+ watchdogPid : dog . pid ,
176
+ } )
171
177
const res = isPromise ( result ) ? await result : result
172
178
removeOnExit ( )
173
179
You can’t perform that action at this time.
0 commit comments