From 5723b368db8e3f564276edd60d5b6fd6e2855a49 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 1 Jul 2018 01:35:45 -0600 Subject: [PATCH] fix error condition --- lib/sorting-hat.js | 2 +- tests/README.md | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/sorting-hat.js b/lib/sorting-hat.js index 436395b..e492015 100644 --- a/lib/sorting-hat.js +++ b/lib/sorting-hat.js @@ -278,7 +278,7 @@ module.exports.assign = function (state, tun, cb) { fs.access(conf.handler, fs.constants.R_OK, function (err1) { fs.stat(conf.handler, function (err2, stat) { - if (err1 || err2 && (stat.isFile() || stat.isDirectory())) { + if ((err1 || err2) || !(stat.isFile() || stat.isDirectory())) { errorTcp(conf, cb); return; } diff --git a/tests/README.md b/tests/README.md index 3dda059..3a310cc 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,13 +1,21 @@ There are a number of conditions and whatnot that must be tested in more-or-less real-world conditions. -telebit init // fresh install -telebit init // after install complete +telebit init // fresh install +telebit init // after install complete -telebit http 3000 // have an app listening on localhost:3000 -telebit http 4545 // do not have an app listening +telebit http 3000 // have an app listening on localhost:3000 +telebit http 4545 // do not have an app listening -telebit ssh auto // do have ssh listening on localhost:22 -telebit ssh 4545 // do have ssh listenening +telebit http ./path/to/site +telebit http ./path/to/dir +telebit http ./path/to/file +telebit http ./doesnt/exist -telebit tcp 3000 // have an echo server listening on localhost:3000 -telebit tcp 4545 // no server listening +telebit ssh auto // do have ssh listening on localhost:22 +telebit ssh 4545 // do have ssh listenening + +telebit tcp 3000 // have an echo server listening on localhost:3000 +telebit tcp 4545 // no server listening + +telebit tcp ./path/to/file +telebit tcp ./path/to/dir