fix: trace-startup crashing child process on macOS (#44257)
This commit is contained in:
parent
df45474b58
commit
af6e2fb257
4 changed files with 44 additions and 13 deletions
|
@ -15,7 +15,7 @@ import * as path from 'node:path';
|
|||
import { setTimeout } from 'node:timers/promises';
|
||||
import * as url from 'node:url';
|
||||
|
||||
import { ifit, ifdescribe, defer, itremote, listen } from './lib/spec-helpers';
|
||||
import { ifit, ifdescribe, defer, itremote, listen, startRemoteControlApp } from './lib/spec-helpers';
|
||||
import { closeAllWindows } from './lib/window-helpers';
|
||||
import { PipeTransport } from './pipe-transport';
|
||||
|
||||
|
@ -556,6 +556,36 @@ describe('command line switches', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('--trace-startup switch', () => {
|
||||
const outputFilePath = path.join(app.getPath('temp'), 'trace.json');
|
||||
afterEach(() => {
|
||||
if (fs.existsSync(outputFilePath)) {
|
||||
fs.unlinkSync(outputFilePath);
|
||||
}
|
||||
});
|
||||
|
||||
it('creates startup trace', async () => {
|
||||
const rc = await startRemoteControlApp(['--trace-startup=*', `--trace-startup-file=${outputFilePath}`, '--trace-startup-duration=1', '--enable-logging']);
|
||||
const stderrComplete = new Promise<string>(resolve => {
|
||||
let stderr = '';
|
||||
rc.process.stderr!.on('data', (chunk) => {
|
||||
stderr += chunk.toString('utf8');
|
||||
});
|
||||
rc.process.on('close', () => { resolve(stderr); });
|
||||
});
|
||||
rc.remotely(() => {
|
||||
global.setTimeout(() => {
|
||||
require('electron').app.quit();
|
||||
}, 5000);
|
||||
});
|
||||
const stderr = await stderrComplete;
|
||||
expect(stderr).to.match(/Completed startup tracing to/);
|
||||
expect(fs.existsSync(outputFilePath)).to.be.true('output exists');
|
||||
expect(fs.statSync(outputFilePath).size).to.be.above(0,
|
||||
`the trace output file is empty, check "${outputFilePath}"`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('chromium features', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue