fix: do not show taskkill.exe output (#10244)
This commit is contained in:
parent
6e5fe5cd89
commit
3a64da7a54
|
|
@ -172,8 +172,12 @@ export async function launchProcess(options: LaunchProcessOptions): Promise<Laun
|
|||
// Force kill the browser.
|
||||
try {
|
||||
if (process.platform === 'win32') {
|
||||
const stdout = childProcess.execSync(`taskkill /pid ${spawnedProcess.pid} /T /F /FI "MEMUSAGE gt 0"`);
|
||||
options.log(`[pid=${spawnedProcess.pid}] taskkill output: ${stdout.toString()}`);
|
||||
const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F /FI "MEMUSAGE gt 0"`, { shell: true });
|
||||
const [stderr, stdout] = [taskkillProcess.stdout.toString(), taskkillProcess.stderr.toString()];
|
||||
if (stdout)
|
||||
options.log(`[pid=${spawnedProcess.pid}] taskkill stdout: ${stdout}`);
|
||||
if (stderr)
|
||||
options.log(`[pid=${spawnedProcess.pid}] taskkill stderr: ${stderr}`);
|
||||
} else {
|
||||
process.kill(-spawnedProcess.pid, 'SIGKILL');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ export class TestChildProcess {
|
|||
return;
|
||||
try {
|
||||
if (process.platform === 'win32')
|
||||
execSync(`taskkill /pid ${this.process.pid} /T /F /FI "MEMUSAGE gt 0"`);
|
||||
execSync(`taskkill /pid ${this.process.pid} /T /F /FI "MEMUSAGE gt 0"`, { stdio: 'ignore' });
|
||||
else
|
||||
process.kill(-this.process.pid, 'SIGKILL');
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ test.slow();
|
|||
test('should close the browser when the node process closes', async ({ startRemoteServer, isWindows, server }) => {
|
||||
const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE });
|
||||
if (isWindows)
|
||||
execSync(`taskkill /pid ${remoteServer.child().pid} /T /F`);
|
||||
execSync(`taskkill /pid ${remoteServer.child().pid} /T /F`, { stdio: 'ignore' });
|
||||
else
|
||||
process.kill(remoteServer.child().pid);
|
||||
// We might not get browser exitCode in time when killing the parent node process,
|
||||
|
|
|
|||
Loading…
Reference in a new issue