Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hagemt/pact
Signals an entire set of PIDs when any one dies.
https://github.com/hagemt/pact
Last synced: about 1 month ago
JSON representation
Signals an entire set of PIDs when any one dies.
- Host: GitHub
- URL: https://github.com/hagemt/pact
- Owner: hagemt
- Created: 2016-01-22T04:59:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-27T19:29:49.000Z (almost 9 years ago)
- Last Synced: 2024-09-14T00:10:56.665Z (2 months ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Overview
This is essentially a basic JavaScript `node` interface for the `pact` tool.
Check out Nick O'Dell's C implementation: https://github.com/nickodell/pact
N.B. `waitpids` does not aim to support the exact flags as `pact` does.
Internally, each `Process` object is an `EventEmitter` for signalling.
# Usage
Example: `require('waitpids')(PID1, PID2) # returns Array of Process objects`
* The `Array` contains exactly what's being monitored. (see Future Work)
* Each `Process` object has a basic interface, to e.g. cancel monitoring.This module packages a basic CLI tool: `waitpids` (wraps exported Function)
Example: `waitpids PID1 PID2 # will send SIGTERM to PIDX when PIDY dies`
# Future Work
N.B. We'd like to do something to avoid polling `kill -0` times a million.
The `natives` folder has some work toward using the `waitpid` syscall.
Ideally, we'd also leverage the host Object `Process` from `node` itself.
The flags that `pact` supports might also be good `waitpid` options.
Consider: `require('waitpids').call({ signal: 'SIGKILL' }, ...)`