MCPcopy Create free account
hub / github.com/webdriverio/webdriverio / killDriverProcess

Function killDriverProcess

packages/webdriver/src/node/utils.ts:10–34  ·  view source on GitHub ↗
(capabilities: WebdriverIO.Capabilities, shutdownDriver: boolean)

Source from the content-addressed store, hash-verified

8 * @param shutdownDriver - whether to shutdown the driver
9 */
10export function killDriverProcess(capabilities: WebdriverIO.Capabilities, shutdownDriver: boolean) {
11 if (shutdownDriver && 'wdio:driverPID' in capabilities && capabilities['wdio:driverPID']) {
12 log.info(`Kill driver process with PID ${capabilities['wdio:driverPID']}`)
13 try {
14 const killedSuccessfully = process.kill(capabilities['wdio:driverPID'], 'SIGKILL')
15 if (!killedSuccessfully) {
16 log.warn('Failed to kill driver process, manually clean-up might be required')
17 }
18 } catch (err) {
19 log.warn('Failed to kill driver process', err)
20 }
21
22 setTimeout(() => {
23 /**
24 * clear up potential leaked TLS Socket handles
25 * see https://github.com/puppeteer/puppeteer/pull/10667
26 */
27 for (const handle of process._getActiveHandles()) {
28 if (handle.servername && handle.servername.includes('edgedl.me')) {
29 handle.destroy()
30 }
31 }
32 }, 10)
33 }
34}

Callers

nothing calls this directly

Calls 5

setTimeoutFunction · 0.85
killMethod · 0.80
_getActiveHandlesMethod · 0.80
infoMethod · 0.45
warnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…