Skip to content

Commit f53ca92

Browse files
fix: no longer swallow stderr logs on linux (#28380)
1 parent 257861b commit f53ca92

File tree

4 files changed

+4
-49
lines changed

4 files changed

+4
-49
lines changed

cli/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ _Released 12/5/2023 (PENDING)_
99
- Fixed an issue where request logging would default the `message` to the `args` of the currently running command even though those `args` would not apply to the request log and are not displayed. If the `args` are sufficiently large (e.g. when running the `cy.task` from the [code-coverage](https://github.com/cypress-io/code-coverage/) plugin) there could be performance/memory implications. Addressed in [#28411](https://github.com/cypress-io/cypress/pull/28411).
1010
- Fixed an issue where commands would fail with the error `must only be invoked from the spec file or support file` if the project's `baseUrl` included basic auth credentials. Fixes [#28336](https://github.com/cypress-io/cypress/issues/28336).
1111
- Fixed an issue where some URLs would timeout in pre-request correlation. Addressed in [#28427](https://github.com/cypress-io/cypress/pull/28427).
12+
- Cypress will now correctly log errors and debug logs on Linux machines. Fixes [#5051](https://github.com/cypress-io/cypress/issues/5051) and [#24713](https://github.com/cypress-io/cypress/issues/24713).
1213

1314
**Misc:**
1415

cli/lib/exec/spawn.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const cp = require('child_process')
44
const path = require('path')
55
const Promise = require('bluebird')
66
const debug = require('debug')('cypress:cli')
7-
const debugElectron = require('debug')('cypress:electron')
87

98
const util = require('../util')
109
const state = require('../tasks/state')
@@ -122,10 +121,9 @@ module.exports = {
122121
return new Promise((resolve, reject) => {
123122
_.defaults(overrides, {
124123
onStderrData: false,
125-
electronLogging: false,
126124
})
127125

128-
const { onStderrData, electronLogging } = overrides
126+
const { onStderrData } = overrides
129127
const envOverrides = util.getEnvOverrides(options)
130128
const electronArgs = []
131129
const node11WindowsFix = isPlatform('win32')
@@ -160,10 +158,6 @@ module.exports = {
160158
stdioOptions = _.extend({}, stdioOptions, { windowsHide: false })
161159
}
162160

163-
if (electronLogging) {
164-
stdioOptions.env.ELECTRON_ENABLE_LOGGING = true
165-
}
166-
167161
if (util.isPossibleLinuxWithIncorrectDisplay()) {
168162
// make sure we use the latest DISPLAY variable if any
169163
debug('passing DISPLAY', process.env.DISPLAY)
@@ -241,7 +235,7 @@ module.exports = {
241235

242236
// if we have a callback and this explicitly returns
243237
// false then bail
244-
if (onStderrData && onStderrData(str) === false) {
238+
if (onStderrData && onStderrData(str)) {
245239
return
246240
}
247241

@@ -294,13 +288,6 @@ module.exports = {
294288
if (util.isBrokenGtkDisplay(str)) {
295289
brokenGtkDisplay = true
296290
}
297-
298-
// we should attempt to always slurp up
299-
// the stderr logs unless we've explicitly
300-
// enabled the electron debug logging
301-
if (!debugElectron.enabled) {
302-
return false
303-
}
304291
},
305292
})
306293
}

cli/lib/tasks/verify.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,8 @@ const runSmokeTest = (binaryDir, options) => {
101101
debug('smoke test command:', smokeTestCommand)
102102
debug('smoke test timeout %d ms', options.smokeTestTimeout)
103103

104-
const env = _.extend({}, process.env, {
105-
ELECTRON_ENABLE_LOGGING: true,
106-
})
107-
108104
const stdioOptions = _.extend({}, {
109-
env,
105+
env: process.env,
110106
timeout: options.smokeTestTimeout,
111107
})
112108

cli/test/lib/tasks/verify_spec.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -278,35 +278,6 @@ context('lib/tasks/verify', () => {
278278
})
279279
})
280280

281-
it('sets ELECTRON_ENABLE_LOGGING without mutating process.env', () => {
282-
createfs({
283-
alreadyVerified: false,
284-
executable: mockfs.file({ mode: 0o777 }),
285-
packageVersion,
286-
})
287-
288-
expect(process.env.ELECTRON_ENABLE_LOGGING).to.be.undefined
289-
290-
util.exec.resolves()
291-
sinon.stub(util, 'stdoutLineMatches').returns(true)
292-
293-
return verify
294-
.start()
295-
.then(() => {
296-
expect(process.env.ELECTRON_ENABLE_LOGGING).to.be.undefined
297-
298-
const stdioOptions = util.exec.firstCall.args[2]
299-
300-
expect(stdioOptions).to.include({
301-
timeout: verify.VERIFY_TEST_RUNNER_TIMEOUT_MS,
302-
})
303-
304-
expect(stdioOptions.env).to.include({
305-
ELECTRON_ENABLE_LOGGING: true,
306-
})
307-
})
308-
})
309-
310281
describe('with force: true', () => {
311282
beforeEach(() => {
312283
createfs({

0 commit comments

Comments
 (0)