Skip to content

Commit

Permalink
test: do not use more command on Windows
Browse files Browse the repository at this point in the history
PR-URL: #11953
Fixes: #11469
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
vsemozhetbyt authored and MylesBorins committed Mar 28, 2017
1 parent 924f346 commit bb2de4a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 45 deletions.
12 changes: 0 additions & 12 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,24 +376,12 @@ Path to the 'root' directory. either `/` or `c:\\` (windows)

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

### spawnCat(options)
* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)

Platform normalizes the `cat` command.

### spawnPwd(options)
* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)

Platform normalizes the `pwd` command.

### spawnSyncCat(options)
* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)

Synchronous version of `spawnCat`.

### spawnSyncPwd(options)
* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
Expand Down
22 changes: 0 additions & 22 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,28 +237,6 @@ exports.ddCommand = function(filename, kilobytes) {
};


exports.spawnCat = function(options) {
const spawn = require('child_process').spawn;

if (exports.isWindows) {
return spawn('more', [], options);
} else {
return spawn('cat', [], options);
}
};


exports.spawnSyncCat = function(options) {
const spawnSync = require('child_process').spawnSync;

if (exports.isWindows) {
return spawnSync('more', [], options);
} else {
return spawnSync('cat', [], options);
}
};


exports.spawnPwd = function(options) {
const spawn = require('child_process').spawn;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-spawn-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo.on('close', common.mustCall((code, signal) => {
}));

// Verify that shell features can be used
const cmd = common.isWindows ? 'echo bar | more' : 'echo bar | cat';
const cmd = 'echo bar | cat';
const command = cp.spawn(cmd, {
encoding: 'utf8',
shell: true
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-spawnsync-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ assert.strictEqual(echo.args[echo.args.length - 1].replace(/"/g, ''),
assert.strictEqual(echo.stdout.toString().trim(), 'foo');

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

assert.strictEqual(command.stdout.toString().trim(), 'bar');
Expand Down
8 changes: 2 additions & 6 deletions test/parallel/test-child-process-stdin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const assert = require('assert');

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

const cat = spawn(common.isWindows ? 'more' : 'cat');
const cat = spawn('cat');
cat.stdin.write('hello');
cat.stdin.write(' ');
cat.stdin.write('world');
Expand Down Expand Up @@ -33,9 +33,5 @@ cat.on('exit', common.mustCall(function(status) {
}));

cat.on('close', common.mustCall(function() {
if (common.isWindows) {
assert.strictEqual('hello world\r\n', response);
} else {
assert.strictEqual('hello world', response);
}
assert.strictEqual('hello world', response);
}));
4 changes: 2 additions & 2 deletions test/parallel/test-child-process-stdio-inherit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;

Expand Down Expand Up @@ -31,5 +31,5 @@ function grandparent() {

function parent() {
// should not immediately exit.
common.spawnCat({ stdio: 'inherit' });
spawn('cat', [], { stdio: 'inherit' });
}
3 changes: 2 additions & 1 deletion test/parallel/test-child-process-stdio.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const spawnSync = require('child_process').spawnSync;

let options = {stdio: ['pipe']};
let child = common.spawnPwd(options);
Expand All @@ -15,7 +16,7 @@ assert.strictEqual(child.stdout, null);
assert.strictEqual(child.stderr, null);

options = {stdio: 'ignore'};
child = common.spawnSyncCat(options);
child = spawnSync('cat', [], options);
assert.deepStrictEqual(options, {stdio: 'ignore'});

assert.throws(() => {
Expand Down

0 comments on commit bb2de4a

Please sign in to comment.