Skip to content

Commit f6de97d

Browse files
committed
Avoid splitting file paths with whitespaces
1 parent 28c3e0a commit f6de97d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/scala/ai/kien/python/Python.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ class Python private[python] (
4646
)
4747
}
4848

49-
lazy val ldflags = for {
49+
lazy val ldflags: Try[Seq[String]] = for {
5050
rawLdflags <- rawLdflags
5151
nativeLibraryPaths <- nativeLibraryPaths
5252
libPathFlags = nativeLibraryPaths.map("-L" + _)
5353
flags = rawLdflags
54-
.split("\\s+")
54+
.split("\\s+(?=-)")
5555
.filter(f => f.nonEmpty && !libPathFlags.contains(f))
56+
.flatMap(f => if (f.startsWith("-L")) Array(f) else f.split("\\s+"))
57+
.toSeq
5658
} yield libPathFlags ++ flags
5759

5860
private val path: String = getEnv("PATH").getOrElse("")

0 commit comments

Comments
 (0)