Skip to content

Commit 513f00a

Browse files
committed
Cleanup xvfb kill
Change-Id: Ic027d6cea2ac2bf080147d9eaf37f22739b186e3
1 parent 42e7894 commit 513f00a

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

lib/support/xvfb.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export async function startXvfb({ size, options }) {
4242
});
4343

4444
const xvfbProcess = execa(command, args, {
45-
stdio: silent ? 'ignore' : 'inherit'
45+
stdio: silent ? 'ignore' : 'inherit',
46+
forceKillAfterDelay: 1000
4647
});
4748

4849
xvfbProcess.catch(error => {
@@ -68,21 +69,10 @@ export async function stopXvfb(xvfbSession) {
6869
}
6970

7071
try {
71-
xvfbSession.process.kill('SIGTERM');
72+
xvfbSession.process.kill();
7273
} catch {
7374
// Just swallow
7475
}
75-
76-
const timeout = 1000;
77-
const start = Date.now();
78-
while (Date.now() - start < timeout) {
79-
try {
80-
process.kill(xvfbSession.process.pid, 0);
81-
await new Promise(resolve => setTimeout(resolve, 100));
82-
} catch {
83-
return;
84-
}
85-
}
8676
}
8777

8878
export class XVFB {

0 commit comments

Comments
 (0)