| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2f1d231 commit f43a876
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,18 +2,16 @@ | |||
| 2 | 2 | const common = require('../common'); | |
| 3 | 3 | const assert = require('assert'); | |
| 4 | 4 | const spawn = require('child_process').spawn; | |
| 5 | - | ||
| 6 | - if (!common.isWindows && process.getuid() === 0) { | ||
| 7 | - common.skip('as this test should not be run as `root`'); | ||
| 8 | - return; | ||
| 9 | - } | ||
| 10 | - | ||
| 11 | 5 | const expectedError = common.isWindows ? /\bENOTSUP\b/ : /\bEPERM\b/; | |
| 12 | 6 | ||
| 13 | - assert.throws(() => { | ||
| 14 | - spawn('echo', ['fhqwhgads'], {uid: 0}); | ||
| 15 | - }, expectedError); | ||
| 7 | + if (common.isWindows || process.getuid() !== 0) { | ||
| 8 | + assert.throws(() => { | ||
| 9 | + spawn('echo', ['fhqwhgads'], {uid: 0}); | ||
| 10 | + }, expectedError); | ||
| 11 | + } | ||
| 16 | 12 | ||
| 17 | - assert.throws(() => { | ||
| 18 | - spawn('echo', ['fhqwhgads'], {gid: 0}); | ||
| 19 | - }, expectedError); | ||
| 13 | + if (common.isWindows || !process.getgroups().some((gid) => gid === 0)) { | ||
| 14 | + assert.throws(() => { | ||
| 15 | + spawn('echo', ['fhqwhgads'], {gid: 0}); | ||
| 16 | + }, expectedError); | ||
| 17 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments