added shell (returns standard shell)
This commit is contained in:
parent
a4fd3e65fa
commit
1ae4ef8c08
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
New Functions
|
New Functions
|
||||||
|
|
||||||
|
- `shell`: returns standard shell e.g. /bin/bash (new in version 3.13)
|
||||||
- `blockDevices`: returns array of block devices like disks, partitions, raids, roms (new in version 3.10)
|
- `blockDevices`: returns array of block devices like disks, partitions, raids, roms (new in version 3.10)
|
||||||
- `dockerContainerProcesses`: returns processes for a specific docker container (new in version 3.8)
|
- `dockerContainerProcesses`: returns processes for a specific docker container (new in version 3.8)
|
||||||
- `versions`: returns object of versions - kernel, ssl, node, npm, ...(new in version 3.6)
|
- `versions`: returns object of versions - kernel, ssl, node, npm, ...(new in version 3.6)
|
||||||
@ -89,6 +90,7 @@ Other changes
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 3.13.0 | 2016-11-23 | added shell (returns standard shell) |
|
||||||
| 3.12.0 | 2016-11-17 | refactoring and extended currentLoad |
|
| 3.12.0 | 2016-11-17 | refactoring and extended currentLoad |
|
||||||
| 3.11.2 | 2016-11-16 | blockDevices: improved for older lsblk versions |
|
| 3.11.2 | 2016-11-16 | blockDevices: improved for older lsblk versions |
|
||||||
| 3.11.1 | 2016-11-16 | fixed small bug in blockDevices |
|
| 3.11.1 | 2016-11-16 | fixed small bug in blockDevices |
|
||||||
|
|||||||
@ -42,6 +42,7 @@ si.cpu()
|
|||||||
|
|
||||||
### Latest Activity
|
### Latest Activity
|
||||||
|
|
||||||
|
- Version 3.13.0: added shell (returns standard shell)
|
||||||
- Version 3.12.0: refactoring and extended currentLoad (better OSX coverage and added irq load).
|
- Version 3.12.0: refactoring and extended currentLoad (better OSX coverage and added irq load).
|
||||||
- Version 3.11.0: blockDevices now also for OSX and also extended (+ label, model, serial, protocol).
|
- Version 3.11.0: blockDevices now also for OSX and also extended (+ label, model, serial, protocol).
|
||||||
- Version 3.10.0: added blockDevices (list of disks, partitions, raids and roms).
|
- Version 3.10.0: added blockDevices (list of disks, partitions, raids and roms).
|
||||||
@ -117,6 +118,7 @@ This library is splitted in several sections:
|
|||||||
| - hostname | X | X | same as os.hostname() |
|
| - hostname | X | X | same as os.hostname() |
|
||||||
| - logofile | X | X | e.g. 'apple', 'debian', 'fedora', ... |
|
| - logofile | X | X | e.g. 'apple', 'debian', 'fedora', ... |
|
||||||
| si.versions(cb) | X | X | Version information (kernel, ssl, node, ...) |
|
| si.versions(cb) | X | X | Version information (kernel, ssl, node, ...) |
|
||||||
|
| si.shell(cb) | X | X | standard shell |
|
||||||
| si.cpu(cb) | X | X | CPU information|
|
| si.cpu(cb) | X | X | CPU information|
|
||||||
| - manufacturer | X | X | e.g. 'Intel(R)' |
|
| - manufacturer | X | X | e.g. 'Intel(R)' |
|
||||||
| - brand | X | X | e.g. 'Core(TM)2 Duo' |
|
| - brand | X | X | e.g. 'Core(TM)2 Duo' |
|
||||||
|
|||||||
@ -7,11 +7,6 @@
|
|||||||
// Copyright: (c) 2014 - 2016
|
// Copyright: (c) 2014 - 2016
|
||||||
// Author: Sebastian Hildebrandt
|
// Author: Sebastian Hildebrandt
|
||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
// Contributors: Guillaume Legrain (https://github.com/glegrain)
|
|
||||||
// Riccardo Novaglia (https://github.com/richy24)
|
|
||||||
// Quentin Busuttil (https://github.com/Buzut)
|
|
||||||
// Lapsio (https://github.com/lapsio)
|
|
||||||
// ----------------------------------------------------------------------------------
|
|
||||||
// License: MIT
|
// License: MIT
|
||||||
// ==================================================================================
|
// ==================================================================================
|
||||||
// 7. Graphics (controller, display)
|
// 7. Graphics (controller, display)
|
||||||
|
|||||||
@ -81,6 +81,7 @@
|
|||||||
// --------------------------------
|
// --------------------------------
|
||||||
//
|
//
|
||||||
// version date comment
|
// version date comment
|
||||||
|
// 3.13.0 2016-11-23 added shell (determines standard shell)
|
||||||
// 3.12.0 2016-11-17 refactoring and extended currentLoad (better OSX coverage and added irq load)
|
// 3.12.0 2016-11-17 refactoring and extended currentLoad (better OSX coverage and added irq load)
|
||||||
// 3.11.2 2016-11-16 blockDevices: improved for older lsblk versions
|
// 3.11.2 2016-11-16 blockDevices: improved for older lsblk versions
|
||||||
// 3.11.1 2016-11-16 fixed small bug in blockDevices
|
// 3.11.1 2016-11-16 fixed small bug in blockDevices
|
||||||
@ -390,7 +391,7 @@ exports.system = system;
|
|||||||
exports.time = osInfo.time;
|
exports.time = osInfo.time;
|
||||||
exports.osInfo = osInfo.osInfo;
|
exports.osInfo = osInfo.osInfo;
|
||||||
exports.versions = osInfo.versions;
|
exports.versions = osInfo.versions;
|
||||||
|
exports.shell = osInfo.shell;
|
||||||
|
|
||||||
exports.cpu = cpu.cpu;
|
exports.cpu = cpu.cpu;
|
||||||
exports.cpuCurrentspeed = cpu.cpuCurrentspeed;
|
exports.cpuCurrentspeed = cpu.cpuCurrentspeed;
|
||||||
|
|||||||
@ -189,3 +189,26 @@ function versions(callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.versions = versions;
|
exports.versions = versions;
|
||||||
|
|
||||||
|
function shell(callback) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
process.nextTick(() => {
|
||||||
|
if (_windows) {
|
||||||
|
let error = new Error(NOT_SUPPORTED);
|
||||||
|
if (callback) { callback(NOT_SUPPORTED) }
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = '';
|
||||||
|
exec("echo $SHELL", function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result = stdout.toString().split('\n')[0];
|
||||||
|
}
|
||||||
|
if (callback) { callback(result) }
|
||||||
|
resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.shell = shell;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user