Browse Source

test: fix running child-process-uid-gid as root

This skips the child-test-uid-gid test when run as root.
Previously, the test failed if executed as root.

PR-URL: https://github.com/nodejs/node/pull/8864
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
v7.x
Wyatt Preul 8 years ago
committed by James M Snell
parent
commit
2f1a4cb79f
  1. 5
      test/parallel/test-child-process-uid-gid.js

5
test/parallel/test-child-process-uid-gid.js

@ -3,6 +3,11 @@ const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
if (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(() => {

Loading…
Cancel
Save