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.
|
// Force kill the browser.
|
||||||
try {
|
try {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
const stdout = childProcess.execSync(`taskkill /pid ${spawnedProcess.pid} /T /F /FI "MEMUSAGE gt 0"`);
|
const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F /FI "MEMUSAGE gt 0"`, { shell: true });
|
||||||
options.log(`[pid=${spawnedProcess.pid}] taskkill output: ${stdout.toString()}`);
|
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 {
|
} else {
|
||||||
process.kill(-spawnedProcess.pid, 'SIGKILL');
|
process.kill(-spawnedProcess.pid, 'SIGKILL');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ export class TestChildProcess {
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
if (process.platform === 'win32')
|
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
|
else
|
||||||
process.kill(-this.process.pid, 'SIGKILL');
|
process.kill(-this.process.pid, 'SIGKILL');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ test.slow();
|
||||||
test('should close the browser when the node process closes', async ({ startRemoteServer, isWindows, server }) => {
|
test('should close the browser when the node process closes', async ({ startRemoteServer, isWindows, server }) => {
|
||||||
const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE });
|
const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE });
|
||||||
if (isWindows)
|
if (isWindows)
|
||||||
execSync(`taskkill /pid ${remoteServer.child().pid} /T /F`);
|
execSync(`taskkill /pid ${remoteServer.child().pid} /T /F`, { stdio: 'ignore' });
|
||||||
else
|
else
|
||||||
process.kill(remoteServer.child().pid);
|
process.kill(remoteServer.child().pid);
|
||||||
// We might not get browser exitCode in time when killing the parent node process,
|
// We might not get browser exitCode in time when killing the parent node process,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue