npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

herod

v0.4.3

Published

Herod, an heartless killer / handler for ( long-running ) child processes.

Downloads

17

Readme

###Herod. build status NPM version

Herod, an heartless killer / handler for ( long-running ) child processes. When the main process dies, it kills all registered ( long-running ) child process.

###Install

$ npm install herod [-g]

require and get an instance of Herod singleton:

var Herod  = require( 'herod' );

###Run Tests

$ cd herod/
$ npm test

###Properties


/*
 * Hash of alive child processes:
 * {
 *  'pid123': {
 *      name: 'cmd,
 *      process : .. 
 *   },
 *   ...
 * }
 * 
 */
Herod.childrens : Object

/*
 * Number of alive handled childrens.
 * ( it holds the cardinality of Herod.childrens object )
 */
Herod.alive : Number

/*
 * Enable console logging for Herod notice messages,
 * it defaults to false.
 */
Herod.debug : Boolean

// last received signal, like 'SIGINT', 'SIGTERM', ..
Herod.lsignal : String

###Methods

Arguments within [ ] are optional.

/*
 * Create a child process through ChildProcess#spawn, then automatically
 * enlist / register it to Herod.
 * 
 * It returns the child process or undefined if no child was added.
 * ( a ChildProcess is an instance of EventEmitter ).
 * 
 * - cargs defaults to : [].
 * - copt defaults to : {
 *      cwd : '/tmp',
 *      stdio : 'pipe',
 *      detached : false
 *   }
 *
 * Note : { detached : true } to create a long-running child process.
 */
Herod#spawn( String cmd [, Array cargs [, Object copt ] ] ) : EventEmitter

/*
 * Adding a child process to handle.
 * It returns the child pid or undefined, if no child was added 
 */
Herod#enlist( EventEmitter child [, String name [, Array args [, Object copt ] ] ] ) : String

/*
 * Kill a child process through its pid.
 * The signal defaults to 'SIGKILL'.
 */
Herod#kill( Number pid, [ String signal [, Function cback ] ] ) : Boolean

/*
 * Kill all child processes sending them the same signal.
 * The signal defaults to 'SIGKILL'.
 * It returns the number of alive processes.
 */
Herod#genocide( [ String signal [, Function cback  ] ) : undefined

/*
 * Specify a signal to send for killing all enlisted child processes
 * and the main process itself.
 * 'cback' will called on main process 'exit' event.
 */
Herod#suicide( [ String signal [, Function cback ] ] ) : undefined

/*
 * Spawn a daemon process for current script, exiting the main parent process.
 * It reloads / spawn the script in which Herod#daemonize is called, as a 
 * long-running child process.
 *
 * default options are:
 * {
 *    stdin : 'ignore',
 *    stdout : 'ignore',
 *    stderr : 'ignore',
 *    env : process.env
 * }
 * for debugging, use process.stdin and process.stdout streams.
 */
Herod#daemonize( [ Object options ] ) : undefined

MIT License

Copyright (c) 2012 < Guglielmo Ferri : [email protected] >

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.