Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spec: preserve stderr from the browser, refs SD-2148
test plan: 1. see previous patchset build where Xvfb was intentionally killed 2. note the `ERROR:browser_main_loop.cc(272)] Gtk: cannot open display: :20.0` Change-Id: Ia7bd7f82e85972c25fe7221cb2441473a3267936 Reviewed-on: https://gerrit.instructure.com/106517 Tested-by: Jenkins Reviewed-by: Landon Wilkins <lwilkins@instructure.com> Product-Review: Landon Wilkins <lwilkins@instructure.com> QA-Review: Landon Wilkins <lwilkins@instructure.com>
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* preserve stderr from chrome/etc., so we can know why it fails, e.g. | ||
* | ||
* [7644:7644:0327/202136.818897:ERROR:browser_main_loop.cc(272)] Gtk: cannot open display: | ||
* | ||
* this is a bit hacky... karma DI plugin stuff is magical and crazy 'n | ||
* all, but it doesn't let you override ProcessLauncher stuff (unless you | ||
* also want to copypasta all of karma-chrome-launcher and more). so | ||
* just override this one thing before karma proper loads up | ||
*/ | ||
|
||
const ProcessLauncher = require('karma/lib/launchers/process') | ||
const tempDir = require('karma/lib/temp_dir') | ||
const { spawn } = require('child_process') | ||
|
||
ProcessLauncher.decoratorFactory = function (timer) { | ||
return function (launcher, processKillTimeout) { | ||
const spawnWithStderrPassthrough = function (command, args = [], options = {}) { | ||
const newOptions = Object.assign({}, options) | ||
newOptions.stdio = ['ignore', 'ignore', 'inherit'] | ||
return spawn.call(null, command, args, newOptions) | ||
} | ||
ProcessLauncher.call(launcher, spawnWithStderrPassthrough, tempDir, timer, processKillTimeout) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters