Skip to content

Commit

Permalink
extra checks for unreliable fs.watchFile()
Browse files Browse the repository at this point in the history
Could not pull the request directly as the code didn't lint properly. Added make lint to the test command. Closes #13
  • Loading branch information
bermi committed Sep 23, 2013
1 parent ff6ad72 commit a412218
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ help:
test:
@make setup
@make clean
@make lint
@mocha --reporter spec $(MOCHAFLAGS)

# Lints the code
Expand Down
6 changes: 5 additions & 1 deletion lib/sauce-connect-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ function run(options, callback) {
// Watching file as directory watching does not work on
// all File Systems http://nodejs.org/api/fs.html#fs_caveats
watcher = fs.watchFile(readyfile, {persistent: false}, function () {
ready();
fs.exists(readyfile, function (exists) {
if (exists) {
ready();
}
});
});

watcher.on("error", callback);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"url": "https://github.com/bermi/sauce-connect-launcher"
},
"scripts": {
"test": "mocha --reporter spec"
"test": "make test"
},
"dependencies": {
"lodash": "~1.3.1",
Expand Down

0 comments on commit a412218

Please sign in to comment.