New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

spawn-auto-restart

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spawn-auto-restart

spawn-auto-restart

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by25%
Maintainers
3
Weekly downloads
 
Created
Source

spawn auto restart

Important: Use it for dev only!

It executes a command through spawn and restart the process in case any change has been detected or the child process has crashed.

Installation

Install via npm:

$ npm install spawn-auto-restart

Usage

require('spawn-auto-restart')({
  proc: 'executable path',
  watch: __dirname
});

To enable logs set an environment variable like this:

DEBUG=spawn-auto-restart

advanced args options

  • spawn
  • chokidar
require('spawn-auto-restart')({
  proc: {
    command: 'executable path',
    // ... any spawn argument
    args: ['--dev'],
    cwd: __dirname
  },
  watch: {
    path: 'file, dir, glob, or array',
    // ... any chokidar argument
    ignored: /[\/\\]\./,
    persistent: true
  }
});

Example

Auto restarting an electron app in development when changes have been applied in the main process.

node DEBUG=spawn-auto-restart restart.js

#!/usr/bin/env node

var join = require('path').join;
var electron = require('electron-prebuilt');


var main = join(__dirname, '../src/browser/main.js');
var watch = join(__dirname, '../src/browser');


require('spawn-auto-restart')({
  proc: {
    command: electron,
    args: main
  },
  watch: watch
});

Changelog

Contributing

It is required to use editorconfig.

License

Copyright (c) 2015 Max Claus Nunes. This software is licensed under the MIT License.

Keywords

FAQs

Package last updated on 23 Jan 2021

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