From 7b8ca9fd735e2cf8da3d6de46bd337d73fd9feba Mon Sep 17 00:00:00 2001 From: Praneeth Bodduluri Date: Tue, 1 Sep 2015 17:56:25 +0530 Subject: [PATCH] Start the fs watch after the VPN directory has been created - Use finally and not then --- src/utils.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils.coffee b/src/utils.coffee index 24c0b970..2671da58 100644 --- a/src/utils.coffee +++ b/src/utils.coffee @@ -74,7 +74,8 @@ disableConnectivityCheck = false checkHost = (options) -> if disableConnectivityCheck or pauseConnectivityCheck return true - return networkCheck.checkHost(options) + else + return networkCheck.checkHost(options) # Custom monitor that uses checkHost function above. customMonitor = (options, fn) -> @@ -103,6 +104,8 @@ exports.connectivityCheck = _.once -> parsedUrl = url.parse(config.apiEndpoint) fs.mkdirAsync(config.vpnStatusPath) .then -> + console.log('Creating directory for watching VPN status...') + .finally -> fs.watch(config.vpnStatusPath, vpnStatusInotifyCallback) .catch EEXIST, (err) ->