Repository: remy/nodemon (js)

Issue:
Relative files with leading `./` are not watched
<!-- 
  when raising an issue please include replies to the following questions, 
  and if you're reporting a bug, please include details on how to replicate
  and **assume** I have no knowledge of how your systems work - that includes
  gulp, grunt, webpack, etc. Thank you so much <3
-->

- `nodemon -v`: 1.8.1
- `node -v`: 9.8.0
- Operating system/terminal environment: macOS
- Command you ran: `nodemon --watch ./foo/bar.js --exec 'echo foo'`


### Expected behaviour

When editing `./foo/bar.js`, watch should trigger.

### Actual behaviour

When editing `./foo/bar.js`, watch does not trigger.

I have to remove the leading `./` from the path in order for this to work.

`nodemon --watch foo/bar.js --exec 'echo foo'`

However, nodemon should allow the leading `./`, as this is a valid path.

Pull request:
 fix: allow watching relative path files
Fixes #1355

Patch:
diff --git a/doc/cli/help.txt b/doc/cli/help.txt
index 11b749f..adc4ba8 100644
--- a/doc/cli/help.txt
+++ b/doc/cli/help.txt
@@ -5,7 +5,7 @@
   --config file ............ alternate nodemon.json config file to use
   -e, --ext ................ extensions to look for, ie. js,jade,hbs.
   -x, --exec app ........... execute script with "app", ie. -x "python -v".
-  -w, --watch dir........... watch directory "dir" or files. use once for
+  -w, --watch path.......... watch directory "path" or files. use once for
                              each directory or file to watch.
   -i, --ignore ............. ignore specific files or directories.
   -V, --verbose ............ show detail on what is causing restarts.
diff --git a/faq.md b/faq.md
index e94d004..5149734 100644
--- a/faq.md
+++ b/faq.md
@@ -226,6 +226,28 @@ Try the following command on terminal:
 echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
 ```
 
+## "Port in use" with --inspect flag and docker
+
+The workaround is to use [kill-port](https://github.com/tiaanduplessis/kill-port) to close off the debugger port, used similarly to:
+
+```bash
+nodemon --delay 80ms --exec 'kill-port -k 9228/tcp; node --inspect=0.0.0.0:9228 ./app/http.js'
+```
+
+[Original suggestion here](https://github.com/remy/nodemon/issues/1050#issuecomment-323680697) and [addition information here](https://github.com/remy/nodemon/issues/1346#issuecomment-401218386).
+
+## Windows: nodemon keeps restarting without changes
+
+This _might_ be related to a Microsoft Windows release pertaining to the OS and breaking `fsevents` module (which is used by [chokidar](https://github.com/paulmillr/chokidar) - the underlying watch package).
+
+The workaround is to run the following command:
+
+```bash
+fsutil behavior set disablelastaccess 1
+```
+
+[Futher reading thread](https://github.com/remy/nodemon/issues/1354)
+
 ## Error: Cannot find module 'internal/util/types'
 
 If you see the error `Cannot find module 'internal/util/types'`, the error is solved with a clean npm cache and trying to reinstall the dependency you're working with.
diff --git a/lib/monitor/match.js b/lib/monitor/match.js
index 1c7c4cf..3261ced 100644
--- a/lib/monitor/match.js
+++ b/lib/monitor/match.js
@@ -160,7 +160,8 @@ function match(files, monitor, ext) {
       return '!**' + (prefix !== path.sep ? path.sep : '') + s.slice(1);
     }
 
-    if (s.slice(0, 2) === '..') {
+    // if it starts with a period, then let's get the relative path
+    if (s.indexOf('.') === 0) {
       return path.resolve(cwd, s);
     }
 


Test patch:
diff --git a/test/monitor/match.test.js b/test/monitor/match.test.js
index 19674f3..6f59db6 100644
--- a/test/monitor/match.test.js
+++ b/test/monitor/match.test.js
@@ -557,4 +557,18 @@ describe('watcher', function() {
       }
     );
   });
+
+  it('should watch relative paths', function() {
+    const monitor = match.rulesToMonitor([ './http.js' ], [], {
+      dirs: [],
+    });
+
+    var matched = match(
+      ['http.js'],
+      monitor,
+      'js,mjs,json'
+    );
+    assert(matched.result.length === 1, 'found match ' + matched.results);
+  });
+
 });