Comparing version 2.4.0 to 2.5.0
@@ -55,3 +55,3 @@ declare module 'terminate' { | ||
* if it's empty or not defined. | ||
* @param opts - options to object. | ||
* @param opts - options object. | ||
*/ | ||
@@ -68,3 +68,3 @@ export default function terminate(pid: number, signal: string, opts: TerminateOptions): void; | ||
* if it's empty or not defined. | ||
* @param opts - options to object. | ||
* @param opts - options object. | ||
* @param callback - if you want to know once the procesess have been terminated, | ||
@@ -95,3 +95,3 @@ * supply a callback. | ||
* if it's empty or not defined. | ||
* @param opts - options to object. | ||
* @param opts - options object. | ||
* @param callback - if you want to know once the procesess have been terminated, | ||
@@ -108,3 +108,3 @@ * supply a callback. | ||
* @param pid - the Process ID you want to terminate. | ||
* @param opts - options to object. | ||
* @param opts - options object. | ||
*/ | ||
@@ -111,0 +111,0 @@ export default function terminate(pid: number, opts: TerminateOptions): void; |
{ | ||
"name": "terminate", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Terminate a Node.js Process based on the Process ID", | ||
@@ -5,0 +5,0 @@ "main": "terminate.js", |
@@ -32,6 +32,7 @@ # terminate | ||
if (err) { // you will get an error if you did not supply a valid process.pid | ||
console.log("Oopsy: " + err); // handle errors in your preferred way. | ||
console.log('Oopsy:', err); // handle errors in your preferred way. | ||
} | ||
else { | ||
console.log('done'); // terminating the Processes succeeded. | ||
// NOTE: The above won't be run in this example as the process itself will be killed before. | ||
} | ||
@@ -45,2 +46,19 @@ }); | ||
#### Promise API | ||
If you are **using Node.js 8+**, you can load the Promise version importing the module `terminate/promise.js` like this: | ||
```js | ||
const terminate = require('terminate/promise'); | ||
(async () => { | ||
try { | ||
await terminate(process.pid); | ||
console.log('done'); | ||
} catch (err) { | ||
console.log('Oopsy:', err); | ||
} | ||
})(); | ||
``` | ||
<br /> | ||
@@ -47,0 +65,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
331779
12
8834
168