Skip to content

Commit 9bffcfa

Browse files
ilgonmicSpace
authored andcommitted
[Gradle, JS] Fix path setting in Windows
1 parent 06a205f commit 9bffcfa

File tree

1 file changed

+11
-4
lines changed
  • libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/yarn

1 file changed

+11
-4
lines changed

libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/yarn/YarnBasics.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,17 @@ abstract class YarnBasics : NpmApi {
4040
if (yarn.ignoreScripts) "--ignore-scripts" else ""
4141

4242
val nodeExecutable = nodeJs.requireConfigured().nodeExecutable
43-
exec.environment(
44-
"PATH",
45-
"$nodeExecutable${File.pathSeparator}${System.getenv("PATH")}"
46-
)
43+
if (!yarn.ignoreScripts) {
44+
val nodePath = if (nodeJs.requireConfigured().isWindows) {
45+
File(nodeExecutable).parent
46+
} else {
47+
nodeExecutable
48+
}
49+
exec.environment(
50+
"PATH",
51+
"$nodePath${File.pathSeparator}${System.getenv("PATH")}"
52+
)
53+
}
4754

4855
val command = yarn.executable
4956
if (yarn.standalone) {

0 commit comments

Comments
 (0)