node/test/parallel/test-child-process-uid-gid.js
Rich Trott d0151695a7 test: add test for uid/gid setting in spawn
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: https://github.com/nodejs/node/pull/7084
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-06-03 13:42:24 -07:00

15 lines
370 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
const expectedError = common.isWindows ? /\bENOTSUP\b/ : /\bEPERM\b/;
assert.throws(() => {
spawn('echo', ['fhqwhgads'], {uid: 0});
}, expectedError);
assert.throws(() => {
spawn('echo', ['fhqwhgads'], {gid: 0});
}, expectedError);