Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cach

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cach

A simple program to restart your NodeJS app when it exits with an error.

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-77.78%
Maintainers
1
Weekly downloads
 
Created
Source

Cach

Discord Travis CI Depfu npm

A simple program to restart your NodeJS app when it exits with an error. Useful for Discord bots.

Installation

For global use:

$ npm install -g cach

For local use:

$ npm install --save cach

Usage

On the command line:

$ cach
Running `npm start`...

$ cach ember serve
Running `ember serve`...

In a script:

var cach = require("cach");

// Runs npm start with cach
cach();

// Runs ember serve with cach
cach("ember serve");

// Runs npm test with cach,
// and also logs messages
cach("npm test", true);

Testing

$ git clone https://github.com/bottza/cach
Cloning into 'cach'...
remote: Counting objects: 37, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 37 (delta 13), reused 23 (delta 3), pack-reused 0
Unpacking objects: 100% (37/37), done.

$ cd cach

$ npm test
> cach@1.0.0 test C:\Programming\cach
> ava

  4 tests passed

Comparison to PM2

Cach:

$ cach
Running `npm start`...

Ok. How do I stop it? Ctrl-C is intuitive...

^C
$ 

It worked!!!!

PM2:

$ pm2 start node main.js
[PM2] Spawning PM2 daemon with pm2_home=C:\Users\archmaster\.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting D:\Documents\Programmimg\BootBot\main.js in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬───────┬──────────┐
│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user  │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼───────┼──────────┤
│ main     │ 0  │ fork │ 24268 │ online │ 0       │ 0s     │ 0%  │ 29.0 MB   │ felix │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴───────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

Wait AAAAAAAHHH so confusing! How do I know what's happening? How do I even stop it? It's not running in my terminal so I can't do Ctrl-C! Reads help. Sooo...

$ pm2 stop 0
[PM2] Applying action stopProcessId on app [0](ids: 0)
[PM2] [node](0) ✓
┌──────────┬────┬──────┬─────┬─────────┬─────────┬────────┬─────┬────────┬───────┬──────────┐
│ App name │ id │ mode │ pid │ status  │ restart │ uptime │ cpu │ mem    │ user  │ watching │
├──────────┼────┼──────┼─────┼─────────┼─────────┼────────┼─────┼────────┼───────┼──────────┤
│ node     │ 0  │ fork │ 0   │ stopped │ 0       │ 0      │ 0%  │ 0 B    │ felix │ disabled │
└──────────┴────┴──────┴─────┴─────────┴─────────┴────────┴─────┴────────┴───────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app

Well... it's stopped... but it's still showing up! Imma install cach.

Keywords

FAQs

Package last updated on 03 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc