fix: do not show taskkill.exe output (#10244)

This commit is contained in:
Max Schmitt 2021-11-11 18:32:22 +01:00 committed by GitHub
parent 6e5fe5cd89
commit 3a64da7a54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -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');
}

View file

@ -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) {

View file

@ -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,