diff --git a/src/main/java/de/illjut/gradle/semrel/NodeExec.java b/src/main/java/de/illjut/gradle/semrel/NodeExec.java index 96a4577..cfe3963 100644 --- a/src/main/java/de/illjut/gradle/semrel/NodeExec.java +++ b/src/main/java/de/illjut/gradle/semrel/NodeExec.java @@ -50,9 +50,19 @@ private ProcessResult exec(List command, File workDir) throws IOExceptio } private ProcessResult exec(List command, File workDir, File nodePathOverride) throws IOException { + String pathVar = null, pathValue = null; + if (nodePathOverride != null) { command.set(0, this.nodePath.getAbsolutePath() + "/" + command.get(0)); this.logger.info("using executable {}", command.get(0)); + + this.logger.info("using custom node path {}", nodePathOverride); + if (System.getenv("Path") != null) { + pathVar = "Path"; + } else { + pathVar = "PATH"; + } + pathValue = nodePathOverride + File.pathSeparator + System.getenv(pathVar); } try { @@ -60,6 +70,8 @@ private ProcessResult exec(List command, File workDir, File nodePathOver .directory(workDir) .redirectErrorStream(true); + if (pathVar != null) processBuilder.environment().put(pathVar, pathValue); + Process proc = processBuilder.start(); LogStream logStream = new LogStream(this.logger, proc.getInputStream());