|
22 | 22 | 'use strict'; |
23 | 23 | const common = require('../common'); |
24 | 24 |
|
25 | | -// this test only fails with CentOS 6.3 using kernel version 2.6.32 |
26 | | -// On other linuxes and darwin, the `read` call gets an ECONNRESET in |
| 25 | +// Ref: https://github.com/nodejs/node-v0.x-archive/issues/5504 |
| 26 | +// |
| 27 | +// This test only fails with CentOS 6.3 using kernel version 2.6.32. |
| 28 | +// On other Linuxes and macOS, the `read` call gets an ECONNRESET in |
27 | 29 | // that case. On sunos, the `write` call fails with EPIPE. |
28 | 30 | // |
29 | | -// However, old CentOS will occasionally send an EOF instead of a |
| 31 | +// However, old CentOS will occasionally send an EOF instead of an |
30 | 32 | // ECONNRESET or EPIPE when the client has been destroyed abruptly. |
31 | 33 | // |
32 | 34 | // Make sure we don't keep trying to write or read more in that case. |
@@ -74,25 +76,24 @@ function parent() { |
74 | 76 | NODE_DEBUG: 'net' |
75 | 77 | }) |
76 | 78 | }); |
77 | | - let c; |
78 | 79 |
|
79 | 80 | wrap(s.stderr, process.stderr, 'SERVER 2>'); |
80 | 81 | wrap(s.stdout, process.stdout, 'SERVER 1>'); |
81 | | - s.on('exit', common.mustCall(common.noop)); |
| 82 | + s.on('exit', common.mustCall()); |
82 | 83 |
|
83 | 84 | s.stdout.once('data', common.mustCall(function() { |
84 | | - c = spawn(node, [__filename, 'client']); |
| 85 | + const c = spawn(node, [__filename, 'client']); |
85 | 86 | wrap(c.stderr, process.stderr, 'CLIENT 2>'); |
86 | 87 | wrap(c.stdout, process.stdout, 'CLIENT 1>'); |
87 | | - c.on('exit', common.mustCall(common.noop)); |
| 88 | + c.on('exit', common.mustCall()); |
88 | 89 | })); |
89 | 90 |
|
90 | 91 | function wrap(inp, out, w) { |
91 | 92 | inp.setEncoding('utf8'); |
92 | | - inp.on('data', function(c) { |
93 | | - c = c.trim(); |
94 | | - if (!c) return; |
95 | | - out.write(`${w}${c.split('\n').join(`\n${w}`)}\n`); |
| 93 | + inp.on('data', function(chunk) { |
| 94 | + chunk = chunk.trim(); |
| 95 | + if (!chunk) return; |
| 96 | + out.write(`${w}${chunk.split('\n').join(`\n${w}`)}\n`); |
96 | 97 | }); |
97 | 98 | } |
98 | 99 | } |
0 commit comments