forked from BetterDiscord/find-process
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On some Linux systems netstat will output a warning if not run as root. This API gives API users more control over showing this warning: ```javascript const processes = await find('port', 80, { logLevel: 'error' }); ``` This change is backwards compatible: ```javascript // Equivalent await find('name', 'nginx', true), await find('name', 'nginx', { strict: true }), // Equivalent await find('name', 'nginx'), await find('name', 'nginx', false), await find('name', 'nginx', { strict: false}), ``` fix yibn2008#59
- Loading branch information
Showing
8 changed files
with
74 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
declare function find(type: "name" | "pid" | "port", value: string | number | RegExp, strict?: boolean): Promise<{ | ||
// https://github.com/pimterry/loglevel/blob/f5a642299bf77a81118d68766a168c9568ecd21b/index.d.ts#L14-L38 | ||
interface LogLevel { | ||
TRACE: 0; | ||
DEBUG: 1; | ||
INFO: 2; | ||
WARN: 3; | ||
ERROR: 4; | ||
SILENT: 5; | ||
} | ||
|
||
type LogLevelNumbers = LogLevel[keyof LogLevel]; | ||
|
||
type LogLevelDesc = LogLevelNumbers | ||
| 'trace' | ||
| 'debug' | ||
| 'info' | ||
| 'warn' | ||
| 'error' | ||
| 'silent' | ||
| keyof LogLevel; | ||
|
||
declare type Options = { | ||
strict?: boolean; | ||
logLevel?: LogLevelDesc; | ||
} | ||
|
||
declare function find(type: "name" | "pid" | "port", value: string | number | RegExp, strict?: boolean | Option): Promise<{ | ||
pid: number; | ||
ppid?: number; | ||
uid?: number; | ||
gid?: number; | ||
name: string; | ||
cmd: string; | ||
}[]> | ||
export = find; | ||
export = find; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict' | ||
|
||
const log = require('loglevel') | ||
|
||
module.exports = log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters