mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 01:43:00 +00:00

The process.getuid method does not exist on this platform. Ref: https://github.com/nodejs/node/pull/8864 PR-URL: https://github.com/nodejs/node/pull/8924 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
20 lines
493 B
JavaScript
20 lines
493 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawn;
|
|
|
|
if (!common.isWindows && process.getuid() === 0) {
|
|
common.skip('as this test should not be run as `root`');
|
|
return;
|
|
}
|
|
|
|
const expectedError = common.isWindows ? /\bENOTSUP\b/ : /\bEPERM\b/;
|
|
|
|
assert.throws(() => {
|
|
spawn('echo', ['fhqwhgads'], {uid: 0});
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
spawn('echo', ['fhqwhgads'], {gid: 0});
|
|
}, expectedError);
|