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 = {
12
12
aix : 'ps' ,
13
13
} ;
14
14
15
+ var methodToRequireFn = {
16
+ ps : ( ) => require ( './ps' ) ,
17
+ wmic : ( ) => require ( './wmic' ) ,
18
+ } ;
19
+
15
20
var platform = os . platform ( ) ;
16
21
if ( platform . startsWith ( 'win' ) ) {
17
22
platform = 'win' ;
18
23
}
19
24
20
- var file = platformToMethod [ platform ] ;
25
+ var method = platformToMethod [ platform ] ;
21
26
22
27
/**
23
28
* Gets the list of all the pids of the system.
24
29
* @param {Function } callback Called when the list is ready.
25
30
*/
26
31
function get ( callback ) {
27
- if ( file === undefined ) {
32
+ if ( method === undefined ) {
28
33
callback (
29
34
new Error (
30
35
os . platform ( ) +
@@ -33,7 +38,7 @@ function get(callback) {
33
38
) ;
34
39
}
35
40
36
- var list = require ( './' + file ) ;
41
+ var list = methodToRequireFn [ method ] ( ) ;
37
42
list ( callback ) ;
38
43
}
39
44
You can’t perform that action at this time.
0 commit comments