Skip to content

Commit 2dff3a2

Browse files
committedMar 23, 2017
test: do not use more command on Windows
PR-URL: #11953 Fixes: #11469 Reviewed-By: João Reis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 8a639bb commit 2dff3a2

7 files changed

+8
-45
lines changed
 

‎test/README.md

-12
Original file line numberDiff line numberDiff line change
@@ -376,24 +376,12 @@ Path to the 'root' directory. either `/` or `c:\\` (windows)
376376

377377
Logs '1..0 # Skipped: ' + `msg`
378378

379-
### spawnCat(options)
380-
* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
381-
* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
382-
383-
Platform normalizes the `cat` command.
384-
385379
### spawnPwd(options)
386380
* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
387381
* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
388382

389383
Platform normalizes the `pwd` command.
390384

391-
### spawnSyncCat(options)
392-
* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
393-
* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
394-
395-
Synchronous version of `spawnCat`.
396-
397385
### spawnSyncPwd(options)
398386
* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
399387
* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)

‎test/common.js

-22
Original file line numberDiff line numberDiff line change
@@ -261,28 +261,6 @@ exports.ddCommand = function(filename, kilobytes) {
261261
};
262262

263263

264-
exports.spawnCat = function(options) {
265-
const spawn = require('child_process').spawn;
266-
267-
if (exports.isWindows) {
268-
return spawn('more', [], options);
269-
} else {
270-
return spawn('cat', [], options);
271-
}
272-
};
273-
274-
275-
exports.spawnSyncCat = function(options) {
276-
const spawnSync = require('child_process').spawnSync;
277-
278-
if (exports.isWindows) {
279-
return spawnSync('more', [], options);
280-
} else {
281-
return spawnSync('cat', [], options);
282-
}
283-
};
284-
285-
286264
exports.spawnPwd = function(options) {
287265
const spawn = require('child_process').spawn;
288266

‎test/parallel/test-child-process-spawn-shell.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ echo.on('close', common.mustCall((code, signal) => {
3434
}));
3535

3636
// Verify that shell features can be used
37-
const cmd = common.isWindows ? 'echo bar | more' : 'echo bar | cat';
37+
const cmd = 'echo bar | cat';
3838
const command = cp.spawn(cmd, {
3939
encoding: 'utf8',
4040
shell: true

‎test/parallel/test-child-process-spawnsync-shell.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ assert.strictEqual(echo.args[echo.args.length - 1].replace(/"/g, ''),
2323
assert.strictEqual(echo.stdout.toString().trim(), 'foo');
2424

2525
// Verify that shell features can be used
26-
const cmd = common.isWindows ? 'echo bar | more' : 'echo bar | cat';
26+
const cmd = 'echo bar | cat';
2727
const command = cp.spawnSync(cmd, {shell: true});
2828

2929
assert.strictEqual(command.stdout.toString().trim(), 'bar');

‎test/parallel/test-child-process-stdin.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const assert = require('assert');
2525

2626
const spawn = require('child_process').spawn;
2727

28-
const cat = spawn(common.isWindows ? 'more' : 'cat');
28+
const cat = spawn('cat');
2929
cat.stdin.write('hello');
3030
cat.stdin.write(' ');
3131
cat.stdin.write('world');
@@ -54,9 +54,5 @@ cat.on('exit', common.mustCall(function(status) {
5454
}));
5555

5656
cat.on('close', common.mustCall(function() {
57-
if (common.isWindows) {
58-
assert.strictEqual('hello world\r\n', response);
59-
} else {
60-
assert.strictEqual('hello world', response);
61-
}
57+
assert.strictEqual('hello world', response);
6258
}));

‎test/parallel/test-child-process-stdio-inherit.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
const common = require('../common');
23+
require('../common');
2424
const assert = require('assert');
2525
const spawn = require('child_process').spawn;
2626

@@ -52,5 +52,5 @@ function grandparent() {
5252

5353
function parent() {
5454
// should not immediately exit.
55-
common.spawnCat({ stdio: 'inherit' });
55+
spawn('cat', [], { stdio: 'inherit' });
5656
}

‎test/parallel/test-child-process-stdio.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
'use strict';
2323
const common = require('../common');
2424
const assert = require('assert');
25+
const spawnSync = require('child_process').spawnSync;
2526

2627
let options = {stdio: ['pipe']};
2728
let child = common.spawnPwd(options);
@@ -36,7 +37,7 @@ assert.strictEqual(child.stdout, null);
3637
assert.strictEqual(child.stderr, null);
3738

3839
options = {stdio: 'ignore'};
39-
child = common.spawnSyncCat(options);
40+
child = spawnSync('cat', [], options);
4041
assert.deepStrictEqual(options, {stdio: 'ignore'});
4142

4243
assert.throws(() => {

0 commit comments

Comments
 (0)