/kill-sync

Synchronously kill processes based on their pid. Supports treekill, where child processes are recursively terminated

Primary LanguageTypeScriptMIT LicenseMIT

Kill Sync

pipeline   codecov   Maintainability   Snyk Security   GitHub top language

NPM Version   install size   Depfu   NPM License   GitHub issues

Quality Gate Status   Codacy Badge   DeepSource   codebeat badge   GitHub stars

Downloads Total   Downloads Yearly   Downloads Monthly   Downloads Weekly   Downloads Daily


Synchronously kill processes based on their pid

Supports treekill, where child processes are recursively terminated


1. Installation

npm install kill-sync

2. Usage

Try with Replit.

killSync(pid)
killSync(pid, signal)
killSync(pid, signal, recursive)

Example 1: kill a process with SIGTERM

const killSync = require('kill-sync');
killSync(31842840);

Example 2: kill a process with SIGINT

const killSync = require('kill-sync');
killSync(5313514, 'SIGINT');

Example 3: kill a process with SIGINT recursively

const killSync = require('kill-sync');
killSync(315230, 'SIGINT', true);

3. License

Massachusetts Institute of Technology (MIT)
Copyright (c) 2023 Khiet Tam Nguyen

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the “Software”),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

4. Limitations

There are currently no known limitations.

5. Caveats

kill-sync is modelled after tree-kill and tree-kill-sync.