The Wayback Machine - https://web.archive.org/web/20250407172910/https://github.com/nodejs/node/commit/ff3a1e69f5
Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Commit ff3a1e6

Browse filesBrowse files
furnoxtargos
authored andcommitted
test: cleanup test-stdout-close-catch.js
Added common.mustCall in child process on 'close' callback Changed several 'var' statements to 'const' or 'let' where appropriate Also linting PR-URL: #10006 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
1 parent 49e7029 commit ff3a1e6
Copy full SHA for ff3a1e6

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed
+19-16
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var path = require('path');
5-
var child_process = require('child_process');
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const path = require('path');
5+
const child_process = require('child_process');
66

7-
var testScript = path.join(common.fixturesDir, 'catch-stdout-error.js');
7+
const testScript = path.join(common.fixturesDir, 'catch-stdout-error.js');
88

9-
var cmd = JSON.stringify(process.execPath) + ' ' +
10-
JSON.stringify(testScript) + ' | ' +
11-
JSON.stringify(process.execPath) + ' ' +
12-
'-pe "process.stdin.on(\'data\' , () => process.exit(1))"';
9+
const cmd = JSON.stringify(process.execPath) + ' ' +
10+
JSON.stringify(testScript) + ' | ' +
11+
JSON.stringify(process.execPath) + ' ' +
12+
'-pe "process.stdin.on(\'data\' , () => process.exit(1))"';
1313

14-
var child = child_process.exec(cmd);
15-
var output = '';
16-
var outputExpect = { 'code': 'EPIPE',
17-
'errno': 'EPIPE',
18-
'syscall': 'write' };
14+
const child = child_process.exec(cmd);
15+
let output = '';
16+
const outputExpect = {
17+
code: 'EPIPE',
18+
errno: 'EPIPE',
19+
syscall: 'write'
20+
};
1921

2022
child.stderr.on('data', function(c) {
2123
output += c;
2224
});
2325

24-
child.on('close', function(code) {
26+
27+
child.on('close', common.mustCall(function(code) {
2528
try {
2629
output = JSON.parse(output);
2730
} catch (er) {
@@ -31,4 +34,4 @@ child.on('close', function(code) {
3134

3235
assert.deepStrictEqual(output, outputExpect);
3336
console.log('ok');
34-
});
37+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.