update socials section
This commit is contained in:
45
node_modules/pidtree/lib/get.js
generated
vendored
Normal file
45
node_modules/pidtree/lib/get.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
var os = require('os');
|
||||
|
||||
var platformToMethod = {
|
||||
darwin: 'ps',
|
||||
sunos: 'ps',
|
||||
freebsd: 'ps',
|
||||
netbsd: 'ps',
|
||||
win: 'wmic',
|
||||
linux: 'ps',
|
||||
aix: 'ps',
|
||||
};
|
||||
|
||||
var methodToRequireFn = {
|
||||
ps: () => require("./ps"),
|
||||
wmic: () => require("./wmic")
|
||||
};
|
||||
|
||||
var platform = os.platform();
|
||||
if (platform.startsWith('win')) {
|
||||
platform = 'win';
|
||||
}
|
||||
|
||||
var method = platformToMethod[platform];
|
||||
|
||||
/**
|
||||
* Gets the list of all the pids of the system.
|
||||
* @param {Function} callback Called when the list is ready.
|
||||
*/
|
||||
function get(callback) {
|
||||
if (method === undefined) {
|
||||
callback(
|
||||
new Error(
|
||||
os.platform() +
|
||||
' is not supported yet, please open an issue (https://github.com/simonepri/pidtree)'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
var list = methodToRequireFn[method]();
|
||||
list(callback);
|
||||
}
|
||||
|
||||
module.exports = get;
|
Reference in New Issue
Block a user