2017-01-03 21:16:48 +00:00
|
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the
|
|
|
|
// "Software"), to deal in the Software without restriction, including
|
|
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
|
|
// following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included
|
|
|
|
// in all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2014-11-22 15:59:48 +00:00
|
|
|
'use strict';
|
|
|
|
|
2019-11-22 17:04:46 +00:00
|
|
|
const {
|
2020-11-20 18:01:12 +00:00
|
|
|
ArrayPrototypePush,
|
2020-01-06 02:26:38 +00:00
|
|
|
Float64Array,
|
2020-09-28 14:41:03 +00:00
|
|
|
NumberParseInt,
|
2019-11-22 17:04:46 +00:00
|
|
|
ObjectDefineProperties,
|
2020-11-20 18:01:12 +00:00
|
|
|
StringPrototypeSlice,
|
2019-12-11 19:45:08 +00:00
|
|
|
SymbolToPrimitive,
|
2019-11-22 17:04:46 +00:00
|
|
|
} = primordials;
|
2019-04-09 07:55:53 +00:00
|
|
|
|
2024-09-11 14:46:30 +00:00
|
|
|
const { getTempDir } = internalBinding('credentials');
|
2018-10-14 23:41:32 +00:00
|
|
|
const constants = internalBinding('constants').os;
|
2015-01-21 16:36:59 +00:00
|
|
|
const isWindows = process.platform === 'win32';
|
2010-12-11 08:49:38 +00:00
|
|
|
|
2019-03-18 01:29:39 +00:00
|
|
|
const {
|
|
|
|
codes: {
|
2023-02-12 18:26:21 +00:00
|
|
|
ERR_SYSTEM_ERROR,
|
2019-03-18 01:29:39 +00:00
|
|
|
},
|
2023-02-12 18:26:21 +00:00
|
|
|
hideStackFrames,
|
2019-03-18 01:29:39 +00:00
|
|
|
} = require('internal/errors');
|
2018-08-19 04:34:17 +00:00
|
|
|
const { validateInt32 } = require('internal/validators');
|
2017-10-27 23:27:16 +00:00
|
|
|
|
2017-04-25 21:48:32 +00:00
|
|
|
const {
|
2022-12-17 03:15:23 +00:00
|
|
|
getAvailableParallelism,
|
2017-04-25 21:48:32 +00:00
|
|
|
getCPUs,
|
|
|
|
getFreeMem,
|
2017-10-27 23:27:16 +00:00
|
|
|
getHomeDirectory: _getHomeDirectory,
|
|
|
|
getHostname: _getHostname,
|
|
|
|
getInterfaceAddresses: _getInterfaceAddresses,
|
2017-04-25 21:48:32 +00:00
|
|
|
getLoadAvg,
|
2018-08-19 04:34:17 +00:00
|
|
|
getPriority: _getPriority,
|
2020-02-11 07:38:24 +00:00
|
|
|
getOSInformation: _getOSInformation,
|
2017-04-25 21:48:32 +00:00
|
|
|
getTotalMem,
|
2018-08-30 13:55:11 +00:00
|
|
|
getUserInfo,
|
2022-08-24 22:21:42 +00:00
|
|
|
getUptime: _getUptime,
|
2018-08-19 04:34:17 +00:00
|
|
|
isBigEndian,
|
2023-02-12 18:26:21 +00:00
|
|
|
setPriority: _setPriority,
|
2018-12-17 14:45:24 +00:00
|
|
|
} = internalBinding('os');
|
2017-04-25 21:48:32 +00:00
|
|
|
|
2017-10-27 23:27:16 +00:00
|
|
|
function getCheckedFunction(fn) {
|
2023-10-15 06:50:31 +00:00
|
|
|
return hideStackFrames(function checkError() {
|
2017-10-27 23:27:16 +00:00
|
|
|
const ctx = {};
|
2023-10-15 06:50:31 +00:00
|
|
|
const ret = fn(ctx);
|
2017-10-27 23:27:16 +00:00
|
|
|
if (ret === undefined) {
|
2023-11-11 16:25:08 +00:00
|
|
|
throw new ERR_SYSTEM_ERROR.HideStackFramesError(ctx);
|
2017-10-27 23:27:16 +00:00
|
|
|
}
|
|
|
|
return ret;
|
2019-03-18 01:29:39 +00:00
|
|
|
});
|
2017-10-27 23:27:16 +00:00
|
|
|
}
|
|
|
|
|
2021-01-06 18:53:27 +00:00
|
|
|
const {
|
|
|
|
0: type,
|
|
|
|
1: version,
|
|
|
|
2: release,
|
2022-08-29 07:49:32 +00:00
|
|
|
3: machine,
|
2021-01-06 18:53:27 +00:00
|
|
|
} = _getOSInformation();
|
2020-02-11 07:38:24 +00:00
|
|
|
|
2017-10-27 23:27:16 +00:00
|
|
|
const getHomeDirectory = getCheckedFunction(_getHomeDirectory);
|
|
|
|
const getHostname = getCheckedFunction(_getHostname);
|
|
|
|
const getInterfaceAddresses = getCheckedFunction(_getInterfaceAddresses);
|
2022-08-24 22:21:42 +00:00
|
|
|
const getUptime = getCheckedFunction(_getUptime);
|
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2020-02-11 07:38:24 +00:00
|
|
|
const getOSRelease = () => release;
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2020-02-11 07:38:24 +00:00
|
|
|
const getOSType = () => type;
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2020-02-11 07:38:24 +00:00
|
|
|
const getOSVersion = () => version;
|
2022-08-29 07:49:32 +00:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
const getMachine = () => machine;
|
2017-10-27 23:27:16 +00:00
|
|
|
|
2022-12-17 03:15:23 +00:00
|
|
|
getAvailableParallelism[SymbolToPrimitive] = () => getAvailableParallelism();
|
2019-12-11 19:45:08 +00:00
|
|
|
getFreeMem[SymbolToPrimitive] = () => getFreeMem();
|
|
|
|
getHostname[SymbolToPrimitive] = () => getHostname();
|
2020-02-11 07:38:24 +00:00
|
|
|
getOSVersion[SymbolToPrimitive] = () => getOSVersion();
|
2019-12-11 19:45:08 +00:00
|
|
|
getOSType[SymbolToPrimitive] = () => getOSType();
|
2020-02-11 07:38:24 +00:00
|
|
|
getOSRelease[SymbolToPrimitive] = () => getOSRelease();
|
2022-08-29 07:49:32 +00:00
|
|
|
getMachine[SymbolToPrimitive] = () => getMachine();
|
2020-02-11 07:38:24 +00:00
|
|
|
getHomeDirectory[SymbolToPrimitive] = () => getHomeDirectory();
|
2019-12-11 19:45:08 +00:00
|
|
|
getTotalMem[SymbolToPrimitive] = () => getTotalMem();
|
|
|
|
getUptime[SymbolToPrimitive] = () => getUptime();
|
2017-04-25 21:48:32 +00:00
|
|
|
|
|
|
|
const kEndianness = isBigEndian ? 'BE' : 'LE';
|
|
|
|
|
2017-02-23 08:22:01 +00:00
|
|
|
const avgValues = new Float64Array(3);
|
2017-04-25 21:48:32 +00:00
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {[number, number, number]}
|
|
|
|
*/
|
2017-04-25 21:48:32 +00:00
|
|
|
function loadavg() {
|
2017-02-23 08:22:01 +00:00
|
|
|
getLoadAvg(avgValues);
|
|
|
|
return [avgValues[0], avgValues[1], avgValues[2]];
|
2017-04-25 21:48:32 +00:00
|
|
|
}
|
2017-02-23 08:22:01 +00:00
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* Returns an array of objects containing information about each
|
|
|
|
* logical CPU core.
|
|
|
|
* @returns {Array<{
|
2022-05-10 22:52:19 +00:00
|
|
|
* model: string,
|
|
|
|
* speed: number,
|
2021-04-11 05:54:28 +00:00
|
|
|
* times: {
|
2022-05-10 22:52:19 +00:00
|
|
|
* user: number,
|
|
|
|
* nice: number,
|
|
|
|
* sys: number,
|
|
|
|
* idle: number,
|
|
|
|
* irq: number,
|
|
|
|
* },
|
2021-04-11 05:54:28 +00:00
|
|
|
* }>}
|
|
|
|
*/
|
2018-11-09 04:22:30 +00:00
|
|
|
function cpus() {
|
2019-01-14 14:02:48 +00:00
|
|
|
// [] is a bugfix for a regression introduced in 51cea61
|
|
|
|
const data = getCPUs() || [];
|
2018-11-09 04:22:30 +00:00
|
|
|
const result = [];
|
2019-02-18 13:35:40 +00:00
|
|
|
let i = 0;
|
|
|
|
while (i < data.length) {
|
2020-11-20 18:01:12 +00:00
|
|
|
ArrayPrototypePush(result, {
|
2019-02-18 13:35:40 +00:00
|
|
|
model: data[i++],
|
|
|
|
speed: data[i++],
|
2017-02-26 04:40:39 +00:00
|
|
|
times: {
|
2019-02-18 13:35:40 +00:00
|
|
|
user: data[i++],
|
|
|
|
nice: data[i++],
|
|
|
|
sys: data[i++],
|
|
|
|
idle: data[i++],
|
2023-02-12 18:26:21 +00:00
|
|
|
irq: data[i++],
|
|
|
|
},
|
2018-11-09 04:22:30 +00:00
|
|
|
});
|
2017-02-26 04:40:39 +00:00
|
|
|
}
|
2018-11-09 04:22:30 +00:00
|
|
|
return result;
|
2017-04-25 21:48:32 +00:00
|
|
|
}
|
2012-06-13 02:05:51 +00:00
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2017-04-25 21:48:32 +00:00
|
|
|
function arch() {
|
2011-04-27 03:02:54 +00:00
|
|
|
return process.arch;
|
2017-04-25 21:48:32 +00:00
|
|
|
}
|
2019-12-11 19:45:08 +00:00
|
|
|
arch[SymbolToPrimitive] = () => process.arch;
|
2012-06-13 02:05:51 +00:00
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2017-04-25 21:48:32 +00:00
|
|
|
function platform() {
|
2011-04-27 03:02:54 +00:00
|
|
|
return process.platform;
|
2017-04-25 21:48:32 +00:00
|
|
|
}
|
2019-12-11 19:45:08 +00:00
|
|
|
platform[SymbolToPrimitive] = () => process.platform;
|
2011-11-01 16:23:17 +00:00
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2017-04-25 21:48:32 +00:00
|
|
|
function tmpdir() {
|
2013-03-19 06:58:44 +00:00
|
|
|
if (isWindows) {
|
2024-09-18 02:51:46 +00:00
|
|
|
const path = process.env.TEMP ||
|
2013-03-19 06:58:44 +00:00
|
|
|
process.env.TMP ||
|
2013-03-28 20:19:08 +00:00
|
|
|
(process.env.SystemRoot || process.env.windir) + '\\temp';
|
2024-09-18 02:51:46 +00:00
|
|
|
|
2024-11-02 15:11:44 +00:00
|
|
|
if (path.length > 1 && path[path.length - 1] === '\\' && path[path.length - 2] !== ':') {
|
2024-09-18 02:51:46 +00:00
|
|
|
return StringPrototypeSlice(path, 0, -1);
|
2024-11-02 15:11:44 +00:00
|
|
|
}
|
2024-09-11 14:46:30 +00:00
|
|
|
|
|
|
|
return path;
|
2013-03-19 06:58:44 +00:00
|
|
|
}
|
2016-03-17 04:23:52 +00:00
|
|
|
|
2024-09-11 14:46:30 +00:00
|
|
|
return getTempDir() || '/tmp';
|
2017-04-25 21:48:32 +00:00
|
|
|
}
|
2019-12-11 19:45:08 +00:00
|
|
|
tmpdir[SymbolToPrimitive] = () => tmpdir();
|
2012-06-13 02:05:51 +00:00
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {'BE' | 'LE'}
|
|
|
|
*/
|
2017-04-25 21:48:32 +00:00
|
|
|
function endianness() {
|
|
|
|
return kEndianness;
|
|
|
|
}
|
2019-12-11 19:45:08 +00:00
|
|
|
endianness[SymbolToPrimitive] = () => kEndianness;
|
2013-01-29 16:27:33 +00:00
|
|
|
|
2018-08-16 12:31:04 +00:00
|
|
|
// Returns the number of ones in the binary representation of the decimal
|
|
|
|
// number.
|
|
|
|
function countBinaryOnes(n) {
|
2019-01-09 03:51:39 +00:00
|
|
|
// Count the number of bits set in parallel, which is faster than looping
|
|
|
|
n = n - ((n >>> 1) & 0x55555555);
|
|
|
|
n = (n & 0x33333333) + ((n >>> 2) & 0x33333333);
|
|
|
|
return ((n + (n >>> 4) & 0xF0F0F0F) * 0x1010101) >>> 24;
|
2018-08-16 12:31:04 +00:00
|
|
|
}
|
|
|
|
|
2019-01-09 03:51:39 +00:00
|
|
|
function getCIDR(address, netmask, family) {
|
2018-08-16 12:31:04 +00:00
|
|
|
let ones = 0;
|
|
|
|
let split = '.';
|
|
|
|
let range = 10;
|
|
|
|
let groupLength = 8;
|
|
|
|
let hasZeros = false;
|
2023-02-20 01:25:54 +00:00
|
|
|
let lastPos = 0;
|
2018-08-16 12:31:04 +00:00
|
|
|
|
2022-05-10 09:10:03 +00:00
|
|
|
if (family === 'IPv6') {
|
2018-08-16 12:31:04 +00:00
|
|
|
split = ':';
|
|
|
|
range = 16;
|
|
|
|
groupLength = 16;
|
|
|
|
}
|
|
|
|
|
2023-02-20 01:25:54 +00:00
|
|
|
for (let i = 0; i < netmask.length; i++) {
|
|
|
|
if (netmask[i] !== split) {
|
|
|
|
if (i + 1 < netmask.length) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
const part = StringPrototypeSlice(netmask, lastPos, i);
|
|
|
|
lastPos = i + 1;
|
|
|
|
if (part !== '') {
|
2018-08-16 12:31:04 +00:00
|
|
|
if (hasZeros) {
|
2023-02-20 01:25:54 +00:00
|
|
|
if (part !== '0') {
|
2018-08-16 12:31:04 +00:00
|
|
|
return null;
|
|
|
|
}
|
2023-02-20 01:25:54 +00:00
|
|
|
} else {
|
|
|
|
const binary = NumberParseInt(part, range);
|
|
|
|
const binaryOnes = countBinaryOnes(binary);
|
|
|
|
ones += binaryOnes;
|
|
|
|
if (binaryOnes !== groupLength) {
|
|
|
|
if ((binary & 1) !== 0) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
hasZeros = true;
|
2018-08-16 12:31:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return `${address}/${ones}`;
|
|
|
|
}
|
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
|
|
|
* @returns {Record<string, Array<{
|
2022-05-10 22:52:19 +00:00
|
|
|
* address: string,
|
|
|
|
* netmask: string,
|
2022-05-10 09:10:03 +00:00
|
|
|
* family: 'IPv4' | 'IPv6',
|
2022-05-10 22:52:19 +00:00
|
|
|
* mac: string,
|
|
|
|
* internal: boolean,
|
|
|
|
* scopeid: number,
|
|
|
|
* cidr: string | null,
|
2021-04-11 05:54:28 +00:00
|
|
|
* }>>}
|
|
|
|
*/
|
2017-07-16 15:51:44 +00:00
|
|
|
function networkInterfaces() {
|
2019-01-09 03:51:39 +00:00
|
|
|
const data = getInterfaceAddresses();
|
|
|
|
const result = {};
|
2017-07-16 15:51:44 +00:00
|
|
|
|
2019-01-09 03:51:39 +00:00
|
|
|
if (data === undefined)
|
|
|
|
return result;
|
2022-04-03 15:36:55 +00:00
|
|
|
for (let i = 0; i < data.length; i += 7) {
|
2019-01-09 03:51:39 +00:00
|
|
|
const name = data[i];
|
|
|
|
const entry = {
|
|
|
|
address: data[i + 1],
|
|
|
|
netmask: data[i + 2],
|
|
|
|
family: data[i + 3],
|
|
|
|
mac: data[i + 4],
|
|
|
|
internal: data[i + 5],
|
2023-02-12 18:26:21 +00:00
|
|
|
cidr: getCIDR(data[i + 1], data[i + 2], data[i + 3]),
|
2019-01-09 03:51:39 +00:00
|
|
|
};
|
|
|
|
const scopeid = data[i + 6];
|
|
|
|
if (scopeid !== -1)
|
|
|
|
entry.scopeid = scopeid;
|
|
|
|
|
|
|
|
const existing = result[name];
|
|
|
|
if (existing !== undefined)
|
2020-11-20 18:01:12 +00:00
|
|
|
ArrayPrototypePush(existing, entry);
|
2019-01-09 03:51:39 +00:00
|
|
|
else
|
|
|
|
result[name] = [entry];
|
2018-08-16 12:31:04 +00:00
|
|
|
}
|
2017-07-16 15:51:44 +00:00
|
|
|
|
2019-01-09 03:51:39 +00:00
|
|
|
return result;
|
2017-07-16 15:51:44 +00:00
|
|
|
}
|
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
2021-04-20 16:55:09 +00:00
|
|
|
* @param {number} [pid=0]
|
2021-04-11 05:54:28 +00:00
|
|
|
* @param {number} priority
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-08-19 04:34:17 +00:00
|
|
|
function setPriority(pid, priority) {
|
|
|
|
if (priority === undefined) {
|
|
|
|
priority = pid;
|
|
|
|
pid = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
validateInt32(pid, 'pid');
|
|
|
|
validateInt32(priority, 'priority', -20, 19);
|
|
|
|
|
|
|
|
const ctx = {};
|
|
|
|
|
|
|
|
if (_setPriority(pid, priority, ctx) !== 0)
|
|
|
|
throw new ERR_SYSTEM_ERROR(ctx);
|
|
|
|
}
|
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
2021-04-20 16:55:09 +00:00
|
|
|
* @param {number} [pid=0]
|
2021-04-11 05:54:28 +00:00
|
|
|
* @returns {number}
|
|
|
|
*/
|
2018-08-19 04:34:17 +00:00
|
|
|
function getPriority(pid) {
|
|
|
|
if (pid === undefined)
|
|
|
|
pid = 0;
|
|
|
|
else
|
|
|
|
validateInt32(pid, 'pid');
|
|
|
|
|
|
|
|
const ctx = {};
|
|
|
|
const priority = _getPriority(pid, ctx);
|
|
|
|
|
|
|
|
if (priority === undefined)
|
|
|
|
throw new ERR_SYSTEM_ERROR(ctx);
|
|
|
|
|
|
|
|
return priority;
|
|
|
|
}
|
|
|
|
|
2021-04-11 05:54:28 +00:00
|
|
|
/**
|
2021-04-20 16:55:09 +00:00
|
|
|
* @param {{ encoding?: string }} [options=utf8] If `encoding` is set to
|
|
|
|
* `'buffer'`, the `username`, `shell`, and `homedir` values will
|
|
|
|
* be `Buffer` instances.
|
2021-04-11 05:54:28 +00:00
|
|
|
* @returns {{
|
2022-05-10 22:52:19 +00:00
|
|
|
* uid: number,
|
|
|
|
* gid: number,
|
|
|
|
* username: string,
|
|
|
|
* homedir: string,
|
|
|
|
* shell: string | null,
|
2021-04-11 05:54:28 +00:00
|
|
|
* }}
|
|
|
|
*/
|
2018-08-30 13:55:11 +00:00
|
|
|
function userInfo(options) {
|
|
|
|
if (typeof options !== 'object')
|
|
|
|
options = null;
|
|
|
|
|
|
|
|
const ctx = {};
|
|
|
|
const user = getUserInfo(options, ctx);
|
|
|
|
|
|
|
|
if (user === undefined)
|
|
|
|
throw new ERR_SYSTEM_ERROR(ctx);
|
|
|
|
|
|
|
|
return user;
|
|
|
|
}
|
|
|
|
|
2018-04-19 08:45:25 +00:00
|
|
|
module.exports = {
|
2017-04-25 21:48:32 +00:00
|
|
|
arch,
|
2022-12-17 03:15:23 +00:00
|
|
|
availableParallelism: getAvailableParallelism,
|
2017-04-25 21:48:32 +00:00
|
|
|
cpus,
|
|
|
|
endianness,
|
|
|
|
freemem: getFreeMem,
|
2018-08-19 04:34:17 +00:00
|
|
|
getPriority,
|
2017-04-25 21:48:32 +00:00
|
|
|
homedir: getHomeDirectory,
|
|
|
|
hostname: getHostname,
|
|
|
|
loadavg,
|
2017-07-16 15:51:44 +00:00
|
|
|
networkInterfaces,
|
2017-04-25 21:48:32 +00:00
|
|
|
platform,
|
|
|
|
release: getOSRelease,
|
2018-08-19 04:34:17 +00:00
|
|
|
setPriority,
|
2017-04-25 21:48:32 +00:00
|
|
|
tmpdir,
|
|
|
|
totalmem: getTotalMem,
|
|
|
|
type: getOSType,
|
2018-08-30 13:55:11 +00:00
|
|
|
userInfo,
|
2017-04-25 21:48:32 +00:00
|
|
|
uptime: getUptime,
|
2022-08-29 07:49:32 +00:00
|
|
|
version: getOSVersion,
|
|
|
|
machine: getMachine,
|
2017-04-25 21:48:32 +00:00
|
|
|
};
|
2014-11-10 23:40:58 +00:00
|
|
|
|
2019-11-22 17:04:46 +00:00
|
|
|
ObjectDefineProperties(module.exports, {
|
2017-08-17 03:52:30 +00:00
|
|
|
constants: {
|
2022-06-03 08:23:58 +00:00
|
|
|
__proto__: null,
|
2017-08-17 03:52:30 +00:00
|
|
|
configurable: false,
|
|
|
|
enumerable: true,
|
2023-02-12 18:26:21 +00:00
|
|
|
value: constants,
|
2017-08-17 03:52:30 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
EOL: {
|
2022-06-03 08:23:58 +00:00
|
|
|
__proto__: null,
|
2017-08-17 03:52:30 +00:00
|
|
|
configurable: true,
|
|
|
|
enumerable: true,
|
|
|
|
writable: false,
|
2023-02-12 18:26:21 +00:00
|
|
|
value: isWindows ? '\r\n' : '\n',
|
2021-05-06 13:45:04 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
devNull: {
|
2022-06-03 08:23:58 +00:00
|
|
|
__proto__: null,
|
2021-05-06 13:45:04 +00:00
|
|
|
configurable: true,
|
|
|
|
enumerable: true,
|
|
|
|
writable: false,
|
2023-02-12 18:26:21 +00:00
|
|
|
value: isWindows ? '\\\\.\\nul' : '/dev/null',
|
|
|
|
},
|
2017-04-25 21:48:32 +00:00
|
|
|
});
|