test: do not use more
command on Windows
PR-URL: https://github.com/nodejs/node/pull/11953 Fixes: https://github.com/nodejs/node/issues/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>
This commit is contained in:
parent
8a639bb696
commit
2dff3a22fe
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
@ -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);
|
||||
}));
|
||||
|
@ -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;
|
||||
|
||||
@ -52,5 +52,5 @@ function grandparent() {
|
||||
|
||||
function parent() {
|
||||
// should not immediately exit.
|
||||
common.spawnCat({ stdio: 'inherit' });
|
||||
spawn('cat', [], { stdio: 'inherit' });
|
||||
}
|
||||
|
@ -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);
|
||||
@ -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(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user