Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
* return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)

Platform normalizes the `cat` command.

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

Platform normalizes the `pwd` command.

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

Synchronous version of `spawnCat`.

### spawnSyncPwd(options)
* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
* return [<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 @@ -261,28 +261,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 @@ -25,7 +25,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 @@ -54,9 +54,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
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;

Expand Down Expand Up @@ -52,5 +52,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
Expand Up @@ -22,6 +22,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 @@ -36,7 +37,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