| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 86ed87b commit f6aa7c8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2210,7 +2210,18 @@ The `process.setgroups()` method sets the supplementary group IDs for the | |||
| 2210 | 2210 | Node.js process. This is a privileged operation that requires the Node.js | |
| 2211 | 2211 | process to have `root` or the `CAP_SETGID` capability. | |
| 2212 | 2212 | ||
| 2213 | - The `groups` array can contain numeric group IDs, group names or both. | ||
| 2213 | + The `groups` array can contain numeric group IDs, group names, or both. | ||
| 2214 | + | ||
| 2215 | + ```js | ||
| 2216 | + if (process.getgroups && process.setgroups) { | ||
| 2217 | + try { | ||
| 2218 | + process.setgroups([501]); | ||
| 2219 | + console.log(process.getgroups()); // new groups | ||
| 2220 | + } catch (err) { | ||
| 2221 | + console.log(`Failed to set groups: ${err}`); | ||
| 2222 | + } | ||
| 2223 | + } | ||
| 2224 | + ``` | ||
| 2214 | 2225 | ||
| 2215 | 2226 | This function is only available on POSIX platforms (i.e. not Windows or | |
| 2216 | 2227 | Android). | |
| Back | FazBrowse Home | New Git URL |
0 commit comments