Skip to content

Commit 8724c44

Browse files
TrottMyles Borins
authored andcommitted
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: #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>
1 parent 042e858 commit 8724c44

File tree

2 files changed

+14
-60
lines changed

2 files changed

+14
-60
lines changed

test/disabled/test-child-process-uid-gid.js

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const spawn = require('child_process').spawn;
5+
6+
const expectedError = common.isWindows ? /\bENOTSUP\b/ : /\bEPERM\b/;
7+
8+
assert.throws(() => {
9+
spawn('echo', ['fhqwhgads'], {uid: 0});
10+
}, expectedError);
11+
12+
assert.throws(() => {
13+
spawn('echo', ['fhqwhgads'], {gid: 0});
14+
}, expectedError);

0 commit comments

Comments
 (0)