diff --git a/packages/playwright/src/plugins/webServerPlugin.ts b/packages/playwright/src/plugins/webServerPlugin.ts index b87b8add05..096629e1f5 100644 --- a/packages/playwright/src/plugins/webServerPlugin.ts +++ b/packages/playwright/src/plugins/webServerPlugin.ts @@ -124,7 +124,10 @@ export class WebServerPlugin implements TestRunnerPlugin { if (!signal) throw new Error('skip graceful shutdown'); - process.kill(-launchedProcess.pid!, signal); + // launchedProcess is a shell. not all shells forward signals to their child processes. + // we need to send the signal to the webserver inside the shell. + const webserverPid = launchedProcess.pid!; // TODO: get the actual pid of the webserver + process.kill(webserverPid, signal); return new Promise((resolve, reject) => { const timer = timeout !== 0 ? setTimeout(() => reject(new Error(`process didn't close gracefully within timeout, falling back to SIGKILL`)), timeout)