File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,24 @@ var platformToMethod = {
1212 aix : 'ps' ,
1313} ;
1414
15+ var methodToRequireFn = {
16+ ps : ( ) => require ( './ps' ) ,
17+ wmic : ( ) => require ( './wmic' ) ,
18+ } ;
19+
1520var platform = os . platform ( ) ;
1621if ( platform . startsWith ( 'win' ) ) {
1722 platform = 'win' ;
1823}
1924
20- var file = platformToMethod [ platform ] ;
25+ var method = platformToMethod [ platform ] ;
2126
2227/**
2328 * Gets the list of all the pids of the system.
2429 * @param {Function } callback Called when the list is ready.
2530 */
2631function get ( callback ) {
27- if ( file === undefined ) {
32+ if ( method === undefined ) {
2833 callback (
2934 new Error (
3035 os . platform ( ) +
@@ -33,7 +38,7 @@ function get(callback) {
3338 ) ;
3439 }
3540
36- var list = require ( './' + file ) ;
41+ var list = methodToRequireFn [ method ] ( ) ;
3742 list ( callback ) ;
3843}
3944
You can’t perform that action at this time.
0 commit comments