mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
os: add os.devNull
Provides the platform-specific file path of the null device. PR-URL: https://github.com/nodejs/node/pull/38569 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
parent
74205b3542
commit
e1195312b9
|
|
@ -122,6 +122,18 @@ The properties included on each object include:
|
|||
`nice` values are POSIX-only. On Windows, the `nice` values of all processors
|
||||
are always 0.
|
||||
|
||||
## `os.devNull`
|
||||
<!-- YAML
|
||||
added: REPLACEME
|
||||
-->
|
||||
|
||||
* {string}
|
||||
|
||||
The platform-specific file path of the null device.
|
||||
|
||||
* `\\.\nul` on Windows
|
||||
* `/dev/null` on POSIX
|
||||
|
||||
## `os.endianness()`
|
||||
<!-- YAML
|
||||
added: v0.9.4
|
||||
|
|
|
|||
|
|
@ -382,5 +382,12 @@ ObjectDefineProperties(module.exports, {
|
|||
enumerable: true,
|
||||
writable: false,
|
||||
value: isWindows ? '\r\n' : '\n'
|
||||
},
|
||||
|
||||
devNull: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: false,
|
||||
value: isWindows ? '\\\\.\\nul' : '/dev/null'
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -257,3 +257,10 @@ if (!common.isIBMi) {
|
|||
|
||||
is.number(+os.freemem, 'freemem');
|
||||
is.number(os.freemem(), 'freemem');
|
||||
|
||||
const devNull = os.devNull;
|
||||
if (common.isWindows) {
|
||||
assert.strictEqual(devNull, '\\\\.\\nul');
|
||||
} else {
|
||||
assert.strictEqual(devNull, '/dev/null');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user