Skip to content

Commit

Permalink
test: improve to use template string
Browse files Browse the repository at this point in the history
PR-URL: #17895
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
sreepurnajasti authored and BridgeAR committed Dec 28, 2017
1 parent 507aab5 commit 968e20c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/parallel/test-child-process-fork-net2.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ if (process.argv[2] === 'child') {
process.on('message', function(m, socket) {
if (!socket) return;

console.error('[%d] got socket', id, m);
console.error(`[${id}] got socket ${m}`);

// will call .end('end') or .write('write');
socket[m](m);

socket.resume();

socket.on('data', function() {
console.error('[%d] socket.data', id, m);
console.error(`[${id}] socket.data ${m}`);
});

socket.on('end', function() {
console.error('[%d] socket.end', id, m);
console.error(`[${id}] socket.end ${m}`);
});

// store the unfinished socket
Expand All @@ -54,27 +54,27 @@ if (process.argv[2] === 'child') {
}

socket.on('close', function(had_error) {
console.error('[%d] socket.close', id, had_error, m);
console.error(`[${id}] socket.close ${had_error} ${m}`);
});

socket.on('finish', function() {
console.error('[%d] socket finished', id, m);
console.error(`[${id}] socket finished ${m}`);
});
});

process.on('message', function(m) {
if (m !== 'close') return;
console.error('[%d] got close message', id);
console.error(`[${id}] got close message`);
needEnd.forEach(function(endMe, i) {
console.error('[%d] ending %d/%d', id, i, needEnd.length);
console.error(`[${id}] ending ${i}/${needEnd.length}`);
endMe.end('end');
});
});

process.on('disconnect', function() {
console.error('[%d] process disconnect, ending', id);
console.error(`[${id}] process disconnect, ending`);
needEnd.forEach(function(endMe, i) {
console.error('[%d] ending %d/%d', id, i, needEnd.length);
console.error(`[${id}] ending ${i}/${needEnd.length}`);
endMe.end('end');
});
});
Expand Down Expand Up @@ -107,7 +107,7 @@ if (process.argv[2] === 'child') {
connected += 1;

socket.once('close', function() {
console.log('[m] socket closed, total %d', ++closed);
console.log(`[m] socket closed, total ${++closed}`);
});

if (connected === count) {
Expand Down

0 comments on commit 968e20c

Please sign in to comment.