-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix: don't show EPIPE error #32873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix: don't show EPIPE error #32873
Changes from 12 commits
33f8822
bd5a6a2
e50403e
daeab02
b1482f0
180e0b9
c373855
df27c44
c0ed5c2
813d3f0
5acba96
1440b55
36e1819
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,7 +157,16 @@ export class ProjectConfigIpc extends EventEmitter { | |
|
|
||
| let resolved = false | ||
|
|
||
| this._childProcess.on('error', (err) => { | ||
| this._childProcess.on('error', (err: NodeJS.ErrnoException) => { | ||
| if (err.code === 'EPIPE') { | ||
| debug('EPIPE error in loadConfig() of child process %s', err) | ||
|
|
||
| // @ts-ignore | ||
| resolve() | ||
|
|
||
| return | ||
| } | ||
alexsch01 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: EPIPE handler resolves with wrong typeWhen an EPIPE error occurs in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cursoragent this should be unreachable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to authenticate your request. Please make sure to connect your GitHub account to Cursor. Go to Cursor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing resolved flag prevents proper error handlingWhen EPIPE occurs in |
||
|
|
||
| debug('unhandled error in child process %s', err) | ||
| this.handleChildProcessError(err, this, resolved, reject) | ||
| reject(err) | ||
|
|
@@ -229,7 +238,16 @@ export class ProjectConfigIpc extends EventEmitter { | |
| return new Promise((resolve, reject) => { | ||
| let resolved = false | ||
|
|
||
| this._childProcess.on('error', (err) => { | ||
| this._childProcess.on('error', (err: NodeJS.ErrnoException) => { | ||
| if (err.code === 'EPIPE') { | ||
| debug('EPIPE error in registerSetupIpcHandlers() of child process %s', err) | ||
|
|
||
alexsch01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // @ts-ignore | ||
| resolve() | ||
|
|
||
| return | ||
alexsch01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
alexsch01 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: EPIPE handler resolves with wrong typeWhen an EPIPE error occurs in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing resolved flag prevents proper error handlingWhen EPIPE occurs in |
||
|
|
||
| this.handleChildProcessError(err, this, resolved, reject) | ||
| reject(err) | ||
| }) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import { describe, expect, it, beforeEach, afterEach, jest } from '@jest/globals' | ||
| import { scaffoldMigrationProject as scaffoldProject } from '../helper' | ||
| import { ProjectConfigIpc } from '../../../src/data/ProjectConfigIpc' | ||
|
|
||
| jest.mock('debug', () => { | ||
| globalThis.debugMessages = [] | ||
| const originalDebugModule = jest.requireActual('debug') | ||
|
|
||
| const debug = (namespace) => { | ||
| // @ts-expect-error - mock | ||
| const originalDebug = originalDebugModule(namespace) | ||
|
|
||
| return ((message) => { | ||
| if (namespace === 'cypress:lifecycle:ProjectConfigIpc') { | ||
| globalThis.debugMessages.push(message) | ||
| } | ||
|
|
||
| originalDebug(message) | ||
| }) | ||
| } | ||
|
|
||
| debug.formatters = {} | ||
|
|
||
| return debug | ||
| }) | ||
|
|
||
| describe('ProjectConfigIpc', () => { | ||
| describe('real-child-process', () => { | ||
| let projectConfigIpc | ||
|
|
||
| beforeEach(async () => { | ||
| const projectPath = await scaffoldProject('e2e') | ||
|
|
||
| projectConfigIpc = new ProjectConfigIpc( | ||
| undefined, | ||
| undefined, | ||
| projectPath, | ||
| '', | ||
| false, | ||
| (error) => {}, | ||
| () => {}, | ||
| () => {}, | ||
| ) | ||
| }) | ||
|
|
||
| afterEach(() => { | ||
| projectConfigIpc.cleanupIpc() | ||
| }) | ||
|
|
||
| it('EPIPE error test', async () => { | ||
| const err: NodeJS.ErrnoException = new Error | ||
|
|
||
| err.code = 'EPIPE' | ||
|
|
||
| const OG_once = projectConfigIpc.once | ||
|
|
||
| projectConfigIpc.once = function (evt, listener) { | ||
| if (evt === 'setupTestingType:reply') { | ||
| return listener() | ||
| } | ||
|
|
||
| return OG_once.apply(this, [evt, listener]) | ||
| } | ||
|
|
||
| await projectConfigIpc.loadConfig() | ||
| await projectConfigIpc.registerSetupIpcHandlers() | ||
|
|
||
| projectConfigIpc._childProcess.emit('error', err) | ||
|
|
||
| expect(globalThis.debugMessages.at(-2)).toEqual('EPIPE error in loadConfig() of child process %s') | ||
| expect(globalThis.debugMessages.at(-1)).toEqual('EPIPE error in registerSetupIpcHandlers() of child process %s') | ||
| }) | ||
| }) | ||
| }) |
Uh oh!
There was an error while loading. Please reload this page.