Skip to content

Commit

Permalink
Catch & ignore ENOTCONN errors when piping Cypress subprocess (#5293)
Browse files Browse the repository at this point in the history
* Catch & ignore ENOTCONN errors when piping Cypress subprocess

* Update https-proxy-agent to point back to original repo
  • Loading branch information
flotwig authored and bahmutov committed Oct 7, 2019
1 parent 7e97d96 commit ddf9707
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
3 changes: 2 additions & 1 deletion cli/lib/exec/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,14 @@ module.exports = {
}

// https://github.com/cypress-io/cypress/issues/1841
// https://github.com/cypress-io/cypress/issues/5241
// In some versions of node, it will throw on windows
// when you close the parent process after piping
// into the child process. unpiping does not seem
// to have any effect. so we're just catching the
// error here and not doing anything.
process.stdin.on('error', (err) => {
if (err.code === 'EPIPE') {
if (['EPIPE', 'ENOTCONN'].includes(err.code)) {
return
}

Expand Down
30 changes: 17 additions & 13 deletions cli/test/lib/exec/spawn_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,24 +439,28 @@ describe('lib/exec/spawn', function () {
})
})

it('catches process.stdin errors and returns when code=EPIPE', function () {
this.spawnedProcess.on.withArgs('close').yieldsAsync(0)
// https://github.com/cypress-io/cypress/issues/1841
// https://github.com/cypress-io/cypress/issues/5241
;['EPIPE', 'ENOTCONN'].forEach((errCode) => {
it(`catches process.stdin errors and returns when code=${errCode}`, function () {
this.spawnedProcess.on.withArgs('close').yieldsAsync(0)

return spawn.start()
.then(() => {
let called = false
return spawn.start()
.then(() => {
let called = false

const fn = () => {
called = true
const err = new Error()
const fn = () => {
called = true
const err = new Error()

err.code = 'EPIPE'
err.code = errCode

return process.stdin.emit('error', err)
}
return process.stdin.emit('error', err)
}

expect(fn).not.to.throw()
expect(called).to.be.true
expect(fn).not.to.throw()
expect(called).to.be.true
})
})
})

Expand Down

4 comments on commit ddf9707

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on ddf9707 Oct 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/linux-x64/circle-develop-ddf9707e6b955260d929a55b26491ab02ba06753-161115/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-ddf9707e6b955260d929a55b26491ab02ba06753-161106/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on ddf9707 Oct 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-ddf9707e6b955260d929a55b26491ab02ba06753-27938173/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-ddf9707e6b955260d929a55b26491ab02ba06753-27938173/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on ddf9707 Oct 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-ddf9707e6b955260d929a55b26491ab02ba06753-27938173/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-ddf9707e6b955260d929a55b26491ab02ba06753-27938173/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on ddf9707 Oct 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/darwin-x64/circle-develop-ddf9707e6b955260d929a55b26491ab02ba06753-161119/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-ddf9707e6b955260d929a55b26491ab02ba06753-161118/cypress.tgz

Please sign in to comment.