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

exit_on_eof

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exit_on_eof - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "exit_on_eof",
"version": "1.0.0",
"version": "1.0.1",
"description": "Run a command as a child process and exit process upon EOF (^D)",

@@ -5,0 +5,0 @@ "bin": "./index.js",

@@ -1,23 +0,29 @@

# `exit_on_eof` for Phoenix projects using `npm scripts` instead of Brunch
## `exit_on_eof`
Helper script for Elixir/Phoenix projects using `npm scripts` as a watcher instead of Brunch
`npm install -g exit_on_eof`
## Usage
### Description
This script allows `npm scripts`-based build-workflows to be used with the
Phoenix build process. The phoenix watcher sends `EOF` to shut down the watcher
process (as per Chris McCord here: https://groups.google.com/forum/#!topic/phoenix-talk/IHS9VoO8Kws)
Elixir/Phoenix projects use Brunch by default for front-end workflows, but this can be modified to use
a simpler approach like `npm scripts` as described [here](http://martinholman.co.nz/blog/2015/09/27/elixir-phoenix-browserify/). A problem arises though
when killing/exiting the server. Phoenix sends an EOF signal through `stdin` to the watch process
to indicate it should terminate. `npm scripts`, like many commands, does not respond to EOF like SIGINT
so the node processes remain running.
`npm run ...` is not normally sensitive to `EOF`, this scripts allows clients
to send one command to be run such that it becomes sensitive to both the `SIGINT`
signal and `EOF` from `stdin` to trigger termination. This allows a call to
`npm run` to also become sensitive to `EOF`
This script helps deal with this issue by wrapping a user-given command in a parent process that is sensitive
to both SIGINT and EOF.
#Example
To read more about this sensitivity to EOF as per Chris McCord, view [this](https://groups.google.com/forum/#!topic/phoenix-talk/IHS9VoO8Kws)
(Both [Webpack](https://github.com/webpack/webpack/pull/1311) and [Brunch](https://github.com/brunch/brunch/blob/master/CHANGELOG.md) were actively PR'd to allow for this behavior. This is a stop-gap until a more elegant [solution](https://github.com/phoenixframework/phoenix/issues/1540) presents.)
###Usage
In Phoenix project update `config/dev.exs`:
```
config :{YOUR_PROJECT_NAME_ATOM}, {YOUR_PROJECT_NAME}.Endpoint
...
watchers: [exit_on_eof: ["npm run watch"]]
...
watchers: [exit_on_eof: ["npm run watch"]]
```

@@ -24,0 +30,0 @@ In your `package.json`:

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