Skip to content

Commit cdf40eb

Browse files
committed
tree-kill called after calling kill
1 parent 9e5b0dc commit cdf40eb

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- preparing the environment may be optional
2121
- errors during test function are now saved into test record db
2222
- new config options (see readme)
23+
- kill child processes in job timer
2324

2425

2526
## [1.2.0]

lib.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,10 @@ function startJobTimer(job, kill_children=false) {
245245
const timeout = config.timeout || 8*60000; // How long to wait for the tests to run
246246
return setTimeout(() => {
247247
console.log('Max test time exceeded');
248-
if (kill_children) {
249-
log('Killing all processes');
250-
kill(job.data.process.pid);
251-
} else {
252-
log('Ending test process');
253-
job.data.process.kill();
254-
}
248+
log(kill_children? 'Killing all processes' : 'Ending test process');
249+
let pid = job.data.process.pid;
250+
job.data.process.kill();
251+
if (kill_children) { kill(pid); }
255252
}, timeout);
256253
}
257254

test/lib.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ describe('Test startJobTimer:', function() {
118118
// and kill it. Should be relatively consistent across platforms.
119119
const cmd = 'ping 127.0.0.1 -n 6 > nul';
120120
const childProcess = cp.exec(cmd, () => { done(); });
121+
childProcess.kill = () => {}; // nop
121122
const job = { data: {process: childProcess} };
122123
lib.startJobTimer(job, true);
123124
// Skip to the end...

0 commit comments

Comments
 (0)