# native-watchdog

> A native module that kills the current process if the event loop is unresponsive

Latest version **1.4.2** (published 2023-03-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install native-watchdog
pnpm add native-watchdog
yarn add native-watchdog
bun add native-watchdog
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.4.2 |
| Published | 2023-03-08 |
| First published | 2017-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 36 |
| Author | Microsoft Corporation |
| Maintainers | alexandrudima, joaomoreno.ms, lszomoru, vscode-bot |

## Links

- npm: https://www.npmjs.com/package/native-watchdog
- Repository: https://github.com/Microsoft/node-native-watchdog
- Homepage: https://github.com/Microsoft/node-native-watchdog#readme
- Issues: https://github.com/Microsoft/node-native-watchdog/issues
- npm.io page: https://npm.io/package/native-watchdog

## Recent versions

- 1.4.2 (latest) — 2023-03-08
- 1.4.1 — 2022-11-22
- 1.4.0 — 2022-03-08
- 1.3.0 — 2019-11-21
- 1.2.0 — 2019-09-13
- 1.1.0 — 2019-08-19
- 1.0.0 — 2018-09-13
- 0.3.0 — 2017-08-25
- 0.2.0 — 2017-08-18
- 0.1.0 — 2017-08-14

## README

# Watchdog node module
Kills the current process when another process is no longer running. This helps when the JavaScript event loop might be busy and never recovering e.g. an accidental while true loop.

This is implemented by launching a separate thread from C++ which periodically checks if the given process is still running. Typically, one would watch the parent process id. The watched process is checked every 1s and if it is no longer running, the current process will exit after 6 seconds with the exit code 87.

## Installing

```sh
npm install native-watchdog
```

## Using

```javascript
var watchdog = require('native-watchdog');

watchdog.start(pid);
```

## Developing
 * `npm install -g node-gyp`
 * `node-gyp configure`
 * `node-gyp build` (for debugging use `node-gyp build --debug`)
 * `npm test` (for debugging change `index.js` to load the node module from the `Debug` folder and press `F5`)

## Contributing

This project welcomes contributions and suggestions.  Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

## License
[MIT](https://github.com/Microsoft/node-native-watchdog/blob/master/LICENSE)

---
_Source: https://npm.io/package/native-watchdog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
