From 76641f088d09112ad362c2bae39bdd93cdb9779f Mon Sep 17 00:00:00 2001 From: MaximZaitsev Date: Fri, 15 Jul 2016 12:08:29 +0300 Subject: [PATCH] fixed runtime error on start node js server on old version of node.js --- car_srv/src/main.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/car_srv/src/main.js b/car_srv/src/main.js index 71e0f37c17d..ff8542d1edc 100644 --- a/car_srv/src/main.js +++ b/car_srv/src/main.js @@ -44,11 +44,16 @@ handle["/loadBin"] = handlers.loadBin; handle["/control"] = handlers.control; handle["/other"] = handlers.other; -/*fs.access(executeShell, fs.F_OK, function (error) { - if (!error) { - server.start(router.route, handle); - } else { - console.log("file " + executeShell + " not found. Copy this file to server root dir"); - } -});*/ -server.start(router.route, handle); +if (typeof fs.access == "function") { + fs.access(executeShell, fs.F_OK, function (error) { + if (!error) { + server.start(router.route, handle); + } else { + console.log("file " + executeShell + " not found. Copy this file to server root dir"); + } + }); +} else { + console.log("warning: you have old version of node.js. Check existence of the file st-flash on root of server dir yourself"); + server.start(router.route, handle); +} +// server.start(router.route, handle);