-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run one process for command by default, add --concurrent
option
#29
base: master
Are you sure you want to change the base?
Conversation
I agree, this is a more sane default. However I'm not sure if killing the old process is the best solution, hmm. Yes the run in utils is a horrible and complicated abstraction. I've been hoping to find a good cross-platform solution for this which would support all shell goodies from the platform. E.g. which would use bash -c "dada" if you have it installed. Other than those comments, looks good and thanks for taking time to make this. |
@kimmobrunfeldt i think this PR is ready for review/merge. i couldn't find a decent way to test the killing of the command child process (but i'll trade you for tests on debounce and throttle!). instead, i exercised the functionality in a sample project. that lead to me finding several bugs and understanding that killing processes isn't as straight forward as it looks. my first attempt to fix was based on an attempt using https://github.com/paulpflug/better-spawn. this worked great everywhere if it weren't for a bug in OS X (details: nodejs/node#3596). next, i discovered a technique based on https://github.com/indexzero/ps-tree. it turns out that the most elegant implementation i could find of using this across platforms was inside the https://github.com/mysticatea/npm-run-all project. i decided that instead of rewriting that code, it made sense to just depend on it. i'm a tiny bit worried about depending on an internal implementation of that library, so i used an exact version in package.json so it doesn't risk breaking in the future. let me know if there's anything else you'd like me to change before a merge! |
@kimmobrunfeldt ping :) |
This is a lovely PR and exactly what I'm looking for. +1 |
@kimmobrunfeldt It's been over a year, is this PR good to merge? :-) |
Added this here: https://github.com/corysimmons/chokidar-cli-infanticide
Update Been using this all night. It's amazing being able to live reload Node servers... |
var Promise = require('bluebird'); | ||
var _ = require('lodash'); | ||
var chokidar = require('chokidar'); | ||
var utils = require('./utils'); | ||
var spawn = require('npm-run-all/lib/spawn').default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.default
doesn't work anymore. Just remove it and it works.
Oh dear, 2016, really? |
it's been a while since i needed to use this package. thanks @corysimmons for finding that issue. i've now updating this branch, in case @kimmobrunfeldt comes back and decides to merge. |
This reverts commit 459a149.
actually, reverting that previous update. this PR should still work as intended. i think @corysimmons might have run into an issue because he may have tried to update the on a separate note, i've decided to take the "temporary" status off of my fork and commit to maintaining it. if you're interested, |
A new project Since this project seems to be moving along from this change, I wanted to let everyone know that I just published a new version from my fork. Much gratitude for everyone involved in this project, and especially those who took the time to review this PR and give feedback. If anyone is interested in merging projects in the future, don't be a stranger! |
Hi! My maintenance efforts have been very low for this repo. To help with maintenance, I moved this repository under a new org, where I can add maintainers more easily. @aoberoi would you be interested to join the org? I'm spending now some efforts to update the most commonly used tools I've created in the past. |
addresses #20
adds a new boolean option
--concurrent
which, when true, behaves the same as the tool behaves today. when it is false (the default), it means the previous process launched for the command is killed before a new process is created again. i think this is a more sane default, because its more likely what users already expect. its more dangerous when the option is set to true because commands that recompile files might clobber the same file system state, or in my case, relaunching a server process will fail because the port will already be used.i'm looking for feedback on this implementation, as i don't think its ready to merge yet. here is what i think is left before this can be merged:
utils
implementation ofrun()
? i needed a different abstraction (as the existingrun()
implementation notes, a Promise is probably the wrong abstraction) which provided a reference to the child process, so that it could later be killed.run()
helper launches. might need to completely rethink the design of that helper (and its not even being reused so it can probably just live in thetest/
directory).i also added tests for the
--throttle
and--debounce
options.