fix(launcher): make dumpio and pipe options work together (#4727)
Don't ignore stdout and stderr when using pipe for remote debugging and dumpio is true. In that case puppeteer process connects to the stdout/stderr streams of the child process and it will not hang.
This commit is contained in:
parent
3982a603cc
commit
2abaac10aa
@ -123,7 +123,13 @@ class Launcher {
|
||||
|
||||
const usePipe = chromeArguments.includes('--remote-debugging-pipe');
|
||||
/** @type {!Array<"ignore"|"pipe">} */
|
||||
const stdio = usePipe ? ['ignore', 'ignore', 'ignore', 'pipe', 'pipe'] : ['pipe', 'pipe', 'pipe'];
|
||||
let stdio = ['pipe', 'pipe', 'pipe'];
|
||||
if (usePipe) {
|
||||
if (dumpio)
|
||||
stdio = ['ignore', 'pipe', 'pipe', 'pipe', 'pipe'];
|
||||
else
|
||||
stdio = ['ignore', 'ignore', 'ignore', 'pipe', 'pipe'];
|
||||
}
|
||||
const chromeProcess = childProcess.spawn(
|
||||
chromeExecutable,
|
||||
chromeArguments,
|
||||
|
@ -22,6 +22,16 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||
|
||||
describe('Fixtures', function() {
|
||||
it_fails_ffox('dumpio option should work with pipe option ', async({server}) => {
|
||||
let dumpioData = '';
|
||||
const {spawn} = require('child_process');
|
||||
const options = Object.assign({}, defaultBrowserOptions, {pipe: true, dumpio: true});
|
||||
const res = spawn('node',
|
||||
[path.join(__dirname, 'fixtures', 'dumpio.js'), puppeteerPath, JSON.stringify(options)]);
|
||||
res.stderr.on('data', data => dumpioData += data.toString('utf8'));
|
||||
await new Promise(resolve => res.on('close', resolve));
|
||||
expect(dumpioData).toContain('message from dumpio');
|
||||
});
|
||||
it('should dump browser process stderr', async({server}) => {
|
||||
let dumpioData = '';
|
||||
const {spawn} = require('child_process');
|
||||
|
1
test/fixtures/dumpio.js
vendored
1
test/fixtures/dumpio.js
vendored
@ -2,6 +2,7 @@
|
||||
const [, , puppeteerRoot, options] = process.argv;
|
||||
const browser = await require(puppeteerRoot).launch(JSON.parse(options));
|
||||
const page = await browser.newPage();
|
||||
await page.evaluate(() => console.error('message from dumpio'));
|
||||
await page.close();
|
||||
await browser.close();
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user