cypress: ENOTCONN error on Windows runs
Current behavior:
cypress throws error on Windows when launching more than one run as a separate process with execSync
C:\Users\fetest\Desktop\runners\loki\builds\bkDJzsb2\0\games\bridge\node_modules\cypress\lib\exec\spawn.js:175
throw err;
^
Error: shutdown ENOTCONN
at Socket._final (net.js:409:25)
at callFinal (_stream_writable.js:627:10)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: 'ENOTCONN',
code: 'ENOTCONN',
syscall: 'shutdown'
}
child_process.js:660
throw err;
^
Error: Command failed: "./node_modules/.bin/cypress" run --env layout="portrait-hd",lang="en",suite="dev",url="https://cdn.dopamine-gaming.com/review/games/bridge/dev" --spec cypress/integration/base_spec.js --headed
at checkExecSyncError (child_process.js:621:11)
at execSync (child_process.js:657:15)
at execScript (C:\Users\fetest\Desktop\runners\loki\builds\bkDJzsb2\0\games\bridge\node_modules\automation\bin\test.js:81:5)
at run (C:\Users\fetest\Desktop\runners\loki\builds\bkDJzsb2\0\games\bridge\node_modules\automation\bin\test.js:74:9)
at C:\Users\fetest\Desktop\runners\loki\builds\bkDJzsb2\0\games\bridge\node_modules\automation\bin\test.js:50:42
at Array.forEach (<anonymous>)
at test (C:\Users\fetest\Desktop\runners\loki\builds\bkDJzsb2\0\games\bridge\node_modules\automation\bin\test.js:50:24)
at Object.<anonymous> (C:\Users\fetest\Desktop\runners\loki\builds\bkDJzsb2\0\games\bridge\node_modules\automation\bin\test.js:84:1)
at Module._compile (internal/modules/cjs/loader.js:945:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 996,
stdout: null,
stderr: null
}
Steps to reproduce:
Launch more than one time cypress run command with execSync
execSync('"./node_modules/.bin/cypress" run --spec cypress/integration/base_spec.js');
execSync('"./node_modules/.bin/cypress" run --spec cypress/integration/components_spec.js');
Versions
Cypress v3.4.1 Windows Version 10.0.18362 Node 12.11.0 npm 6.11.3
This issue is related to https://github.com/cypress-io/cypress/issues/1841
and is fixable by adding the erro code into already existing condition (line 169)

About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 16 (7 by maintainers)
As I wrote, I don’t know anything about
execSyncor multiple instances. I’m just running the Cypress test runner as I’ve done since I first started using Cypress months ago. Worked fine before. 😕Started getting this today too, and I have no knowledge of any
execSynccalls. Just running Cypress as I did beforecypress run --project ./cypress… Tried to reboot in case there was anything “hanging”, but that didn’t seem to help anything either… 😕😒Any updates on this? Just updated to Node’s new LTS version 12.13 and I started getting this error now.
Here’s my understanding:
process.stdinfrom the CLI is piped thestdinof the Electron process Cypress runs in. Then, when the underlying Electron process exits, theprocess.stdinstream in the CLI throws anENOTCONNerror (only in Windows, only in Node 12.11.0+). Sometimes, it throws anEPIPEerror instead, which was handled previously to this issue in #1841There’s very little documentation about the meaning of these error codes in Node.js, but I found some info on the generic POSIX meaning here: https://stackoverflow.com/a/902964/3474615
EPIPEandENOTCONNboth basically mean that the pipe is no longer connected at both ends. We handle the exit of the Cypress subprocess by listening for thecloseevent: https://github.com/cypress-io/cypress/pull/5293/files#diff-ff9015f47ff83939a603dd46c4fb45d1R140…so I think it is unlikely that adding
ENOTCONNto the list of suppressed errors will cause any bad behavior - Cypress will still exit normally when the underlying stream exits, it’s not causing any data to be lost (it’s onstdin, which is unused in Cypress), etc.Haven’t been at the office today, so haven’t been able to confirm, but I did upgrade Node to latest version recently too, so sounds like that could maybe be the issue then. 🤔