diff --git a/lib/Launcher.js b/lib/Launcher.js index 86e425bd..5bfd0d7c 100644 --- a/lib/Launcher.js +++ b/lib/Launcher.js @@ -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, diff --git a/test/fixtures.spec.js b/test/fixtures.spec.js index ef421cd9..a2447f64 100644 --- a/test/fixtures.spec.js +++ b/test/fixtures.spec.js @@ -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'); diff --git a/test/fixtures/dumpio.js b/test/fixtures/dumpio.js index b0b5deff..d394998c 100644 --- a/test/fixtures/dumpio.js +++ b/test/fixtures/dumpio.js @@ -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(); })();