From 4b0925d425a9e11e32790e20529f01a30eb19178 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 26 Mar 2018 14:54:47 -0400 Subject: [PATCH] fallback to shelljs if pwd is empty (windows issue) --- lib/modules/solidity/solcW.js | 2 +- lib/utils/utils.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/modules/solidity/solcW.js b/lib/modules/solidity/solcW.js index a773d05ee..55d2ab38b 100644 --- a/lib/modules/solidity/solcW.js +++ b/lib/modules/solidity/solcW.js @@ -32,7 +32,7 @@ class SolcW { if (err) { return done(err); } - let requirePath = utils.joinPath(process.env.PWD, location); + let requirePath = utils.joinPath(utils.pwd(), location); solcProcess.send({action: 'loadCompiler', solcLocation: requirePath}); }); diff --git a/lib/utils/utils.js b/lib/utils/utils.js index f50bb4758..7c1be067f 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -123,6 +123,10 @@ function proposeAlternative(word, _dictionary, _exceptions) { return propose(word, dictionary, {threshold: 0.3}); } +function pwd() { + return process.env.PWD || shelljs.pwd(); +} + module.exports = { joinPath: joinPath, filesMatchingPattern: filesMatchingPattern, @@ -138,5 +142,6 @@ module.exports = { exit: exit, downloadFile: downloadFile, extractTar: extractTar, - proposeAlternative: proposeAlternative + proposeAlternative: proposeAlternative, + pwd: pwd };