• Home
  • Raw
  • Download

Lines Matching full:process

1 # Process  chapter
6 <!-- source_link=lib/process.js -->
8 The `process` object is a `global` that provides information about, and control
9 over, the current Node.js process. As a global, it is always available to
14 const process = require('process');
17 ## Process events
19 The `process` object is an instance of [`EventEmitter`][].
27 no additional work to schedule. Normally, the Node.js process will exit when
29 event can make asynchronous calls, and thereby cause the Node.js process to
33 [`process.exitCode`][] passed as the only argument.
36 termination, such as calling [`process.exit()`][] or uncaught exceptions.
42 process.on('beforeExit', (code) => {
43 console.log('Process beforeExit event with code: ', code);
46 process.on('exit', (code) => {
47 console.log('Process exit event with code: ', code);
54 // Process beforeExit event with code: 0
55 // Process exit event with code: 0
63 If the Node.js process is spawned with an IPC channel (see the [Child Process][]
74 The `'exit'` event is emitted when the Node.js process is about to exit as a
77 * The `process.exit()` method being called explicitly;
81 all `'exit'` listeners have finished running the Node.js process will terminate.
84 by the [`process.exitCode`][] property, or the `exitCode` argument passed to the
85 [`process.exit()`][] method.
88 process.on('exit', (code) => {
94 process will exit immediately after calling the `'exit'` event listeners
99 process.on('exit', (code) => {
116 If the Node.js process is spawned with an IPC channel (see the [Child Process][]
118 message sent by a parent process using [`childprocess.send()`][] is received by
119 the child process.
125 process, the `message` argument can contain data that JSON is not able
152 process.on('multipleResolves', (type, promise, reason) => {
154 setImmediate(() => process.exit(1));
211 process.on('unhandledRejection', (reason, promise) => {
214 process.on('rejectionHandled', (promise) => {
222 likely best for long-running application) or upon process exit (which is likely
246 with code 1, overriding any previously set [`process.exitCode`][].
248 behavior. Alternatively, change the [`process.exitCode`][] in the
249 `'uncaughtException'` handler which will result in the process exiting with the
250 provided exit code. Otherwise, in the presence of such handler the process will
254 process.on('uncaughtException', (err, origin) => {
256 process.stderr.fd,
272 default behavior to exit the process by installing a
285 process will exit with a non-zero exit code and the stack trace will be printed.
294 down the process. **It is not safe to resume normal operation after
299 in a separate process to detect application failures and recover or restart as
316 [`process.setUncaughtExceptionCaptureCallback()`][] is called.
319 once an `'uncaughtException'` event is emitted. The process will
323 process.on('uncaughtExceptionMonitor', (err, origin) => {
342 a process warning.
358 process.on('unhandledRejection', (reason, promise) => {
399 The `'warning'` event is emitted whenever Node.js emits a process warning.
401 A process warning is similar to an error in that it describes exceptional
408 process.on('warning', (warning) => {
415 By default, Node.js will print process warnings to `stderr`. The `--no-warnings`
417 `'warning'` event will still be emitted by the `process` object.
425 > process.on('foo', () => {});
426 > process.on('foo', () => {});
436 > const p = process.on('warning', (warning) => console.warn('Do not do that!'));
438 > process.on('foo', () => {});
439 > process.on('foo', () => {});
469 See the [`process.emitWarning()`][process_emit_warning] method for issuing
500 Signal events will be emitted when the Node.js process receives a signal. Please
513 // Begin reading from stdin so the process does not exit.
514 process.stdin.resume();
516 process.on('SIGINT', () => {
525 process.on('SIGINT', handle);
526 process.on('SIGTERM', handle);
557 artificially using kill(2), inherently leave the process in a state from
558 which it is not safe to call JS listeners. Doing so might cause the process
560 * `0` can be sent to test for the existence of a process, it has no effect if
561 the process exists, but will throw an error if the process does not exist.
564 but Node.js offers some emulation with [`process.kill()`][], and
567 termination of the target process, and afterwards, subprocess will report that
568 the process was terminated by signal.
570 existence of a process.
572 ## `process.abort()`
577 The `process.abort()` method causes the Node.js process to exit immediately and
582 ## `process.allowedNodeEnvironmentFlags`
589 The `process.allowedNodeEnvironmentFlags` property is a special,
593 `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides
595 representations. `process.allowedNodeEnvironmentFlags.has()` will
609 When iterating over `process.allowedNodeEnvironmentFlags`, flags will
615 process.allowedNodeEnvironmentFlags.forEach((flag) => {
624 `process.allowedNodeEnvironmentFlags` do nothing, and will fail
628 [`process.config`][]), `process.allowedNodeEnvironmentFlags` will
631 ## `process.arch`
643 console.log(`This processor architecture is ${process.arch}`);
646 ## `process.argv`
653 The `process.argv` property returns an array containing the command-line
654 arguments passed when the Node.js process was launched. The first element will
655 be [`process.execPath`][]. See `process.argv0` if access to the original value
660 For example, assuming the following script for `process-args.js`:
663 // print process.argv
664 process.argv.forEach((val, index) => {
669 Launching the Node.js process as:
672 $ node process-args.js one two=three four
679 1: /Users/mjr/work/node/process-args.js
685 ## `process.argv0`
692 The `process.argv0` property stores a read-only copy of the original value of
697 > process.argv[0]
699 > process.argv0
703 ## `process.channel`
714 If the Node.js process was spawned with an IPC channel (see the
715 [Child Process][] documentation), the `process.channel`
719 ### `process.channel.ref()`
724 This method makes the IPC channel keep the event loop of the process
728 listeners on the `process` object. However, this method can be used to
731 ### `process.channel.unref()`
736 This method makes the IPC channel not keep the event loop of the process
740 listeners on the `process` object. However, this method can be used to
743 ## `process.chdir(directory)`
750 The `process.chdir()` method changes the current working directory of the
751 Node.js process or throws an exception if doing so fails (for instance, if
755 console.log(`Starting directory: ${process.cwd()}`);
757 process.chdir('/tmp');
758 console.log(`New directory: ${process.cwd()}`);
766 ## `process.config`
773 The `process.config` property returns an `Object` containing the JavaScript
809 The `process.config` property is **not** read-only and there are existing
811 the value of `process.config`.
813 ## `process.connected`
820 If the Node.js process is spawned with an IPC channel (see the [Child Process][]
821 and [Cluster][] documentation), the `process.connected` property will return
823 `process.disconnect()` is called.
825 Once `process.connected` is `false`, it is no longer possible to send messages
826 over the IPC channel using `process.send()`.
828 ## `process.cpuUsage([previousValue])`
834 `process.cpuUsage()`
839 The `process.cpuUsage()` method returns the user and system CPU time usage of
840 the current process, in an object with properties `user` and `system`, whose
843 actual elapsed time if multiple CPU cores are performing work for this process.
845 The result of a previous call to `process.cpuUsage()` can be passed as the
849 const startUsage = process.cpuUsage();
856 console.log(process.cpuUsage(startUsage));
860 ## `process.cwd()`
867 The `process.cwd()` method returns the current working directory of the Node.js
868 process.
871 console.log(`Current directory: ${process.cwd()}`);
874 ## `process.debugPort`
884 process.debugPort = 5858;
887 ## `process.disconnect()`
892 If the Node.js process is spawned with an IPC channel (see the [Child Process][]
893 and [Cluster][] documentation), the `process.disconnect()` method will close the
894 IPC channel to the parent process, allowing the child process to exit gracefully
897 The effect of calling `process.disconnect()` is the same as calling
898 [`ChildProcess.disconnect()`][] from the parent process.
900 If the Node.js process was not spawned with an IPC channel,
901 `process.disconnect()` will be `undefined`.
903 ## `process.dlopen(module, filename[, flags])`
916 The `process.dlopen()` method allows dynamically loading shared objects. It is
919 preferred over `process.dlopen()` unless there are specific reasons such as
925 An important requirement when calling `process.dlopen()` is that the `module`
938 process.dlopen(module, path.join(__dirname, 'local.node'),
943 ## `process.emitWarning(warning[, options])`
955 `process.emitWarning`.
958 The `process.emitWarning()` method can be used to emit custom or application
959 specific process warnings. These can be listened for by adding a handler to the
964 process.emitWarning('Something happened!', {
974 `process.emitWarning()` and passed through to the
978 process.on('warning', (warning) => {
989 ## `process.emitWarning(warning[, type[, code]][, ctor])`
1000 `process.emitWarning`.
1002 The `process.emitWarning()` method can be used to emit custom or application
1003 specific process warnings. These can be listened for by adding a handler to the
1008 process.emitWarning('Something happened!');
1014 process.emitWarning('Something Happened!', 'CustomWarning');
1019 process.emitWarning('Something happened!', 'CustomWarning', 'WARN001');
1024 `process.emitWarning()` and passed through to the [`'warning'`][process_warning]
1028 process.on('warning', (warning) => {
1047 process.emitWarning(myWarning);
1054 While process warnings use `Error` objects, the process warning
1069 As a best practice, warnings should be emitted only once per process. To do
1077 process.emitWarning('Only warn once!');
1086 ## `process.env`
1093 `process.env` by default, configurable through the `env`
1102 The `process.env` property returns an object containing the user environment.
1124 reflected outside the Node.js process, or (unless explicitly requested)
1129 $ node -e 'process.env.foo = "bar"' && echo $foo
1135 process.env.foo = 'bar';
1136 console.log(process.env.foo);
1139 Assigning a property on `process.env` will implicitly convert the value
1144 process.env.test = null;
1145 console.log(process.env.test);
1147 process.env.test = undefined;
1148 console.log(process.env.test);
1152 Use `delete` to delete a property from `process.env`.
1155 process.env.TEST = 1;
1156 delete process.env.TEST;
1157 console.log(process.env.TEST);
1164 process.env.TEST = 1;
1165 console.log(process.env.test);
1170 each [`Worker`][] thread has its own copy of `process.env`, based on its
1171 parent thread’s `process.env`, or whatever was specified as the `env` option
1172 to the [`Worker`][] constructor. Changes to `process.env` will not be visible
1176 ## `process.execArgv`
1183 The `process.execArgv` property returns the set of Node.js-specific command-line
1184 options passed when the Node.js process was launched. These options do not
1185 appear in the array returned by the [`process.argv`][] property, and do not
1194 Results in `process.execArgv`:
1201 And `process.argv`:
1211 ## `process.execPath`
1218 The `process.execPath` property returns the absolute pathname of the executable
1219 that started the Node.js process. Symbolic links, if any, are resolved.
1226 ## `process.exit([code])`
1233 The `process.exit()` method instructs Node.js to terminate the process
1235 either the 'success' code `0` or the value of `process.exitCode` if it has been
1242 process.exit(1);
1247 Calling `process.exit()` will force the process to exit as quickly as possible
1249 completed fully, including I/O operations to `process.stdout` and
1250 `process.stderr`.
1252 In most situations, it is not actually necessary to call `process.exit()`
1253 explicitly. The Node.js process will exit on its own *if there is no additional
1254 work pending* in the event loop. The `process.exitCode` property can be set to
1255 tell the process which exit code to use when the process exits gracefully.
1258 `process.exit()` method that could lead to data printed to stdout being
1265 process.exit(1);
1269 The reason this is problematic is because writes to `process.stdout` in Node.js
1271 event loop. Calling `process.exit()`, however, forces the process to exit
1274 Rather than calling `process.exit()` directly, the code *should* set the
1275 `process.exitCode` and allow the process to exit naturally by avoiding
1280 // the process exit gracefully.
1283 process.exitCode = 1;
1287 If it is necessary to terminate the Node.js process due to an error condition,
1288 throwing an *uncaught* error and allowing the process to terminate accordingly
1289 is safer than calling `process.exit()`.
1292 than the current process.
1294 ## `process.exitCode`
1301 A number which will be the process exit code, when the process either
1302 exits gracefully, or is exited via [`process.exit()`][] without specifying
1305 Specifying a code to [`process.exit(code)`][`process.exit()`] will override any
1306 previous setting of `process.exitCode`.
1308 ## `process.getegid()`
1313 The `process.getegid()` method returns the numerical effective group identity
1314 of the Node.js process. (See getegid(2).)
1317 if (process.getegid) {
1318 console.log(`Current gid: ${process.getegid()}`);
1325 ## `process.geteuid()`
1332 The `process.geteuid()` method returns the numerical effective user identity of
1333 the process. (See geteuid(2).)
1336 if (process.geteuid) {
1337 console.log(`Current uid: ${process.geteuid()}`);
1344 ## `process.getgid()`
1351 The `process.getgid()` method returns the numerical group identity of the
1352 process. (See getgid(2).)
1355 if (process.getgid) {
1356 console.log(`Current gid: ${process.getgid()}`);
1363 ## `process.getgroups()`
1370 The `process.getgroups()` method returns an array with the supplementary group
1375 if (process.getgroups) {
1376 console.log(process.getgroups()); // [ 16, 21, 297 ]
1383 ## `process.getuid()`
1390 The `process.getuid()` method returns the numeric user identity of the process.
1394 if (process.getuid) {
1395 console.log(`Current uid: ${process.getuid()}`);
1402 ## `process.hasUncaughtExceptionCaptureCallback()`
1410 [`process.setUncaughtExceptionCaptureCallback()`][].
1412 ## `process.hrtime([time])`
1417 > Stability: 3 - Legacy. Use [`process.hrtime.bigint()`][] instead.
1419 * `time` {integer[]} The result of a previous call to `process.hrtime()`
1422 This is the legacy version of [`process.hrtime.bigint()`][]
1425 The `process.hrtime()` method returns the current high-resolution real time
1430 `process.hrtime()` call to diff with the current time. If the parameter
1433 `process.hrtime()` will lead to undefined behavior.
1441 const time = process.hrtime();
1445 const diff = process.hrtime(time);
1453 ## `process.hrtime.bigint()`
1460 The `bigint` version of the [`process.hrtime()`][] method returning the
1463 Unlike [`process.hrtime()`][], it does not support an additional `time`
1468 const start = process.hrtime.bigint();
1472 const end = process.hrtime.bigint();
1480 ## `process.initgroups(user, extraGroup)`
1488 The `process.initgroups()` method reads the `/etc/group` file and initializes
1490 a privileged operation that requires that the Node.js process either have `root`
1496 console.log(process.getgroups()); // [ 0 ]
1497 process.initgroups('nodeuser', 1000); // switch user
1498 console.log(process.getgroups()); // [ 27, 30, 46, 1000, 0 ]
1499 process.setgid(1000); // drop root gid
1500 console.log(process.getgroups()); // [ 27, 30, 46, 1000 ]
1507 ## `process.kill(pid[, signal])`
1512 * `pid` {number} A process ID
1516 The `process.kill()` method sends the `signal` to the process identified by
1523 case, a signal of `0` can be used to test for the existence of a process.
1524 Windows platforms will throw an error if the `pid` is used to kill a process
1527 Even though the name of this function is `process.kill()`, it is really just a
1529 other than kill the target process.
1532 process.on('SIGHUP', () => {
1538 process.exit(0);
1541 process.kill(process.pid, 'SIGHUP');
1544 When `SIGUSR1` is received by a Node.js process, Node.js will start the
1547 ## `process.mainModule`
1557 The `process.mainModule` property provides an alternative way of retrieving
1563 As with [`require.main`][], `process.mainModule` will be `undefined` if there
1566 ## `process.memoryUsage()`
1585 Returns an object describing the memory usage of the Node.js process measured in
1589 console.log(process.memoryUsage());
1605 process, including all C++ and JavaScript objects and code.
1613 entire process, while the other fields will only refer to the current thread.
1615 The `process.memoryUsage()` method iterates over each page to gather
1619 ## `process.memoryUsage.rss()`
1626 The `process.memoryUsage.rss()` method returns an integer representing the
1631 process, including all C++ and JavaScript objects and code.
1633 This is the same value as the `rss` property provided by `process.memoryUsage()`
1634 but `process.memoryUsage.rss()` is faster.
1637 console.log(process.memoryUsage.rss());
1641 ## `process.nextTick(callback[, ...args])`
1653 `process.nextTick()` adds `callback` to the "next tick queue". This queue is
1656 create an infinite loop if one were to recursively call `process.nextTick()`.
1661 process.nextTick(() => {
1679 process.nextTick(() => {
1724 process.nextTick(cb);
1732 ### When to use `queueMicrotask()` vs. `process.nextTick()`
1734 The [`queueMicrotask()`][] API is an alternative to `process.nextTick()` that
1743 process.nextTick(() => console.log(1));
1752 JavaScript platform environments and should be favored over `process.nextTick()`.
1754 `process.nextTick()`.
1768 One note-worthy difference between the two APIs is that `process.nextTick()`
1790 not, the `process.on('uncaughtException')` event handler can be used to capture
1793 When in doubt, unless the specific capabilities of `process.nextTick()` are
1796 ## `process.noDeprecation`
1803 The `process.noDeprecation` property indicates whether the `--no-deprecation`
1804 flag is set on the current Node.js process. See the documentation for
1809 ## `process.pid`
1816 The `process.pid` property returns the PID of the process.
1819 console.log(`This process is pid ${process.pid}`);
1822 ## `process.platform`
1829 The `process.platform` property returns a string identifying the operating
1830 system platform on which the Node.js process is running.
1843 console.log(`This platform is ${process.platform}`);
1850 ## `process.ppid`
1860 The `process.ppid` property returns the PID of the parent of the
1861 current process.
1864 console.log(`The parent process is pid ${process.ppid}`);
1867 ## `process.release`
1878 The `process.release` property returns an `Object` containing metadata related
1882 `process.release` contains the following properties:
1919 ## `process.report`
1930 `process.report` is an object whose methods are used to generate diagnostic
1931 reports for the current process. Additional documentation is available in the
1934 ### `process.report.compact`
1946 console.log(`Reports are compact? ${process.report.compact}`);
1949 ### `process.report.directory`
1962 Node.js process.
1965 console.log(`Report directory is ${process.report.directory}`);
1968 ### `process.report.filename`
1984 console.log(`Report filename is ${process.report.filename}`);
1987 ### `process.report.getReport([err])`
2000 running process. The report's JavaScript stack trace is taken from `err`, if
2004 const data = process.report.getReport();
2007 // Similar to process.report.writeReport()
2014 ### `process.report.reportOnFatalError`
2030 console.log(`Report on fatal error: ${process.report.reportOnFatalError}`);
2033 ### `process.report.reportOnSignal`
2044 If `true`, a diagnostic report is generated when the process receives the
2045 signal specified by `process.report.signal`.
2048 console.log(`Report on signal: ${process.report.reportOnSignal}`);
2051 ### `process.report.reportOnUncaughtException`
2065 console.log(`Report on exception: ${process.report.reportOnUncaughtException}`);
2068 ### `process.report.signal`
2083 console.log(`Report signal: ${process.report.signal}`);
2086 ### `process.report.writeReport([filename][, err])`
2097 `process.report.directory`, or the current working directory of the Node.js
2098 process, if unspecified.
2108 process.report.writeReport();
2113 ## `process.resourceUsage()`
2118 * Returns: {Object} the resource usage for the current process. All of these
2122 It is the same value as [`process.cpuUsage().user`][process.cpuUsage].
2124 It is the same value as [`process.cpuUsage().system`][process.cpuUsage].
2134 minor page faults for the process, see
2137 major page faults for the process, see
2153 number of times a CPU context switch resulted due to a process voluntarily
2158 process becoming runnable or because the current process exceeded its
2162 console.log(process.resourceUsage());
2186 ## `process.send(message[, sendHandle[, options]][, callback])`
2196 `net.Socket`. When `true`, the socket is kept open in the sending process.
2201 If Node.js is spawned with an IPC channel, the `process.send()` method can be
2202 used to send messages to the parent process. Messages will be received as a
2205 If Node.js was not spawned with an IPC channel, `process.send` will be
2211 ## `process.setegid(id)`
2218 The `process.setegid()` method sets the effective group identity of the process.
2224 if (process.getegid && process.setegid) {
2225 console.log(`Current gid: ${process.getegid()}`);
2227 process.setegid(501);
2228 console.log(`New gid: ${process.getegid()}`);
2239 ## `process.seteuid(id)`
2246 The `process.seteuid()` method sets the effective user identity of the process.
2252 if (process.geteuid && process.seteuid) {
2253 console.log(`Current uid: ${process.geteuid()}`);
2255 process.seteuid(501);
2256 console.log(`New uid: ${process.geteuid()}`);
2267 ## `process.setgid(id)`
2274 The `process.setgid()` method sets the group identity of the process. (See
2280 if (process.getgid && process.setgid) {
2281 console.log(`Current gid: ${process.getgid()}`);
2283 process.setgid(501);
2284 console.log(`New gid: ${process.getgid()}`);
2295 ## `process.setgroups(groups)`
2302 The `process.setgroups()` method sets the supplementary group IDs for the
2303 Node.js process. This is a privileged operation that requires the Node.js
2304 process to have `root` or the `CAP_SETGID` capability.
2309 if (process.getgroups && process.setgroups) {
2311 process.setgroups([501]);
2312 console.log(process.getgroups()); // new groups
2323 ## `process.setuid(id)`
2330 The `process.setuid(id)` method sets the user identity of the process. (See
2336 if (process.getuid && process.setuid) {
2337 console.log(`Current uid: ${process.getuid()}`);
2339 process.setuid(501);
2340 console.log(`New uid: ${process.getuid()}`);
2351 ## `process.setSourceMapsEnabled(val)`
2363 It provides same features as launching Node.js process with commandline options
2369 ## `process.setUncaughtExceptionCaptureCallback(fn)`
2376 The `process.setUncaughtExceptionCaptureCallback()` function sets a function
2382 command line or set through [`v8.setFlagsFromString()`][], the process will
2387 `process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this
2394 ## `process.stderr`
2398 The `process.stderr` property returns a stream connected to
2403 `process.stderr` differs from other Node.js streams in important ways. See
2404 [note on process I/O][] for more information.
2406 ### `process.stderr.fd`
2411 `process.stderr`. The value is fixed at `2`. In [`Worker`][] threads,
2414 ## `process.stdin`
2418 The `process.stdin` property returns a stream connected to
2425 As a [Duplex][] stream, `process.stdin` can also be used in "old" mode that
2430 must call `process.stdin.resume()` to read from it. Note also that calling
2431 `process.stdin.resume()` itself would switch stream to "old" mode.
2433 ### `process.stdin.fd`
2438 `process.stdin`. The value is fixed at `0`. In [`Worker`][] threads,
2441 ## `process.stdout`
2445 The `process.stdout` property returns a stream connected to
2450 For example, to copy `process.stdin` to `process.stdout`:
2453 process.stdin.pipe(process.stdout);
2456 `process.stdout` differs from other Node.js streams in important ways. See
2457 [note on process I/O][] for more information.
2459 ### `process.stdout.fd`
2464 `process.stdout`. The value is fixed at `1`. In [`Worker`][] threads,
2467 ### A note on process I/O
2469 `process.stdout` and `process.stderr` differ from other Node.js streams in
2485 `process.exit()` is called before an asynchronous write completes. See
2486 [`process.exit()`][] for more information.
2495 the process output streams.
2503 $ node -p "Boolean(process.stdin.isTTY)"
2505 $ echo "foo" | node -p "Boolean(process.stdin.isTTY)"
2507 $ node -p "Boolean(process.stdout.isTTY)"
2509 $ node -p "Boolean(process.stdout.isTTY)" | cat
2515 ## `process.throwDeprecation`
2522 The initial value of `process.throwDeprecation` indicates whether the
2523 `--throw-deprecation` flag is set on the current Node.js process.
2524 `process.throwDeprecation` is mutable, so whether or not deprecation
2530 $ node --throw-deprecation -p "process.throwDeprecation"
2532 $ node -p "process.throwDeprecation"
2535 > process.emitWarning('test', 'DeprecationWarning');
2538 > process.throwDeprecation = true;
2540 > process.emitWarning('test', 'DeprecationWarning');
2545 ## `process.title`
2552 The `process.title` property returns the current process title (i.e. returns
2553 the current value of `ps`). Assigning a new value to `process.title` modifies
2558 For instance, on Linux and macOS, `process.title` is limited to the size of the
2560 `process.title` overwrites the `argv` memory of the process. Node.js v0.8
2561 allowed for longer process title strings by also overwriting the `environ`
2565 Assigning a value to `process.title` might not result in an accurate label
2566 within process manager applications such as macOS Activity Monitor or Windows
2569 ## `process.traceDeprecation`
2576 The `process.traceDeprecation` property indicates whether the
2577 `--trace-deprecation` flag is set on the current Node.js process. See the
2582 ## `process.umask()`
2590 description: Calling `process.umask()` with no arguments is deprecated.
2594 > Stability: 0 - Deprecated. Calling `process.umask()` with no argument causes
2595 > the process-wide umask to be written twice. This introduces a race condition
2599 `process.umask()` returns the Node.js process's file mode creation mask. Child
2600 processes inherit the mask from the parent process.
2602 ## `process.umask(mask)`
2609 `process.umask(mask)` sets the Node.js process's file mode creation mask. Child
2610 processes inherit the mask from the parent process. Returns the previous mask.
2614 const oldmask = process.umask(newmask);
2620 In [`Worker`][] threads, `process.umask(mask)` will throw an exception.
2622 ## `process.uptime()`
2629 The `process.uptime()` method returns the number of seconds the current Node.js
2630 process has been running.
2635 ## `process.version`
2642 The `process.version` property contains the Node.js version string.
2645 console.log(`Version: ${process.version}`);
2650 `process.versions.node`.
2652 ## `process.versions`
2666 The `process.versions` property returns an object listing the version strings of
2667 Node.js and its dependencies. `process.versions.modules` indicates the current
2672 console.log(process.versions);
2706 internal in the Node.js bootstrapping process caused a parse error. This
2710 source code internal in the Node.js bootstrapping process failed to
2729 source code internal in the Node.js bootstrapping process threw an error
2746 [Child Process]: child_process.md
2749 [Event Loop]: https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick
2777 [`process.argv`]: #process_process_argv
2778 [`process.config`]: #process_process_config
2779 [`process.execPath`]: #process_process_execpath
2780 [`process.exit()`]: #process_process_exit_code
2781 [`process.exitCode`]: #process_process_exitcode
2782 [`process.hrtime()`]: #process_process_hrtime_time
2783 [`process.hrtime.bigint()`]: #process_process_hrtime_bigint
2784 [`process.kill()`]: #process_process_kill_pid_signal
2785 [`process.setUncaughtExceptionCaptureCallback()`]: #process_process_setuncaughtexceptioncapturecall…
2795 [note on process I/O]: #process_a_note_on_process_i_o
2796 [process.cpuUsage]: #process_process_cpuusage_previousvalue