Urara-Blog/node_modules/.pnpm-store/v3/files/b0/d867be59417f3f0d674b80d5e45ed0454b8b93a4e5ee479cecd211062dd647befc8dea205aaac9d4ff9f17aa21850171483509cf1b075f109ec6aefaa4923d
2022-08-14 01:14:53 +08:00

40 lines
721 B
Text

'use strict';
var os = require('os');
var platformToMethod = {
darwin: 'ps',
sunos: 'ps',
freebsd: 'ps',
netbsd: 'ps',
win: 'wmic',
linux: 'ps',
aix: 'ps'
};
var platform = os.platform();
if (platform.startsWith('win')) {
platform = 'win';
}
var file = 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 (file === undefined) {
callback(
new Error(
os.platform() +
' is not supported yet, please open an issue (https://github.com/simonepri/pidtree)'
)
);
}
var list = require('./' + file);
list(callback);
}
module.exports = get;