-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved type definitions and provided test/types.ts to validate the …
…usage
- Loading branch information
Showing
2 changed files
with
22 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
/** | ||
* Kills `pid` and all its children | ||
* Kills process identified by `pid` and all its children | ||
* | ||
* @param pid | ||
* @param signal 'SIGTERM' by default | ||
* @param callback Called when killing of the entire tree is done, and it's the result | ||
* of the platform-specific killing command (see docs). | ||
* @param callback | ||
*/ | ||
declare function treeKill( | ||
pid: number, | ||
signal: string, | ||
callback?: (error: Error, stdout: string, stderr: string) => void, | ||
signal?: string | number, | ||
callback?: (error?: Error) => void, | ||
): void; | ||
|
||
declare namespace treeKill {} | ||
|
||
export = treeKill; |
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,17 @@ | ||
// examples of valid usage | ||
// importing just the type definitions, not the actual code | ||
import * as kill from '../index.d'; | ||
|
||
|
||
kill(1); | ||
kill(1, 9); | ||
kill(1, 'SIGKILL'); | ||
kill(1, 'SIGKILL', () => { | ||
console.log('done'); | ||
}); | ||
kill(1, 'SIGKILL', (err) => { | ||
if (err) { | ||
console.log(err.message); | ||
} | ||
console.log('done'); | ||
}); |