We don't use pipe by default for stdio spawn, we look at how nodemon is being used, the either decide to use pipe or process.stdout/err. Then depending on whether nodemon is required, we then attach to the different stdout/err streams as required.
Fixes#299 and fixes#308.
This means if you use nodemon to monitor a .js script, but explicitly watch another file (that isn't .js) then nodemon *will* restart as expected.
Changed it from using `.on('data')` to using a PassThrough stream which does the job much better, but the readline demos don't work when they're doing anything special on stdout, like `.cursorTo`. WIP.
In favour of attempting to find the basedir the pattern sits on, but only try when the path looks like a pattern, otherwise it's more likely to be an incorrect directory.
We're purposely putting Mac over to the `find` command. This is because it has a default ulimit of 256 - which is WAY LOW, and without asking the user to `unlimit -n <BIG-ASS-NUMBER>` it'll throw up all over your screen like this: http://d.pr/i/R6B8+
Note that I have to use setTimeout (I tried process.nextTick but it was still too soon) to delay between disconnecting the stdin pipe and actually restarting the child.
I've tested this with a simple script that echos stdin, and used the "rs" restart command over and over and it avoids the two EPIPE and ECONNRESET errors. I'm not sure I can easily create automated tests for this, but I'll try at a later date...maybe.
Something weird is happening with required nodemon and re-running lots of times, that somehow resets the config. I know it's due to my tests, but I'm unsure which one is actually causing the damn issue. Anyway, bed for me, it's almost 2am. Sod this for a game of cricket.
Now using minimatch to match globs to files that have changed. Logic orders the rules in order of specificity (i.e. deeper paths have higher specificity) and the file runs through the rules.
Fixed nodemon to echo out what's being watched in the regexp instead of the config.dir path.
Also allowing patterns on the "watch" config setting, rather than just paths.
Removed useless test (that kept failing...incorrectly).