diff --git a/nodejs.php b/nodejs.php index cee8097..fa17ef2 100755 --- a/nodejs.php +++ b/nodejs.php @@ -16,10 +16,13 @@ public function init() if (!$this[NODEJS]) { $this->_initNodePath(); } else { - if (!\PMVC\realPath($this[NODEJS])) { + $nodejs = \PMVC\realPath($this[NODEJS]); + if (!$nodejs) { throw new InvalidArgumentException( 'NodeJs path was not found. [' . $this[NODEJS] . ']' ); + } else { + $this[NODEJS] = $nodejs; } } } @@ -36,11 +39,11 @@ public function getNodeJs() private function _initNodePath() { - $alpinePath = '/usr/bin/node'; - $vendorPath = __DIR__ . '/../../bin/node'; - if (\PMVC\realPath($alpinePath)) { + $alpinePath = \PMVC\realPath('/usr/bin/node'); + $vendorPath = \PMVC\realPath(__DIR__ . '/../../bin/node'); + if ($alpinePath) { $this[NODEJS] = $alpinePath; - } elseif (\PMVC\realPath($vendorPath)) { + } elseif ($vendorPath) { $this[NODEJS] = $vendorPath; } }