Skip to content

Commit

Permalink
using cmd in windows with /c param
Browse files Browse the repository at this point in the history
  • Loading branch information
adamfilipow92 committed Mar 31, 2021
1 parent dcf6c38 commit b1e55f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal fun parseObjcTests(binary: String): List<String> {
var cmd = if (!isWindows) "nm -U ${binary.quote()}" else "llvm-nm.exe --undefined-only ${binary.quote()}"
if (!isMacOS) cmd = if (isWindows) cmd.replace("\\", "/") else "PATH=~/.flank $cmd"

val path = if (isWindows) listOf(Pair("Path", "$appDataDirectory\\.flank\\"))
val path = if (isWindows) listOf(Pair("Path", "$appDataDirectory\\.flank\\;C:\\Windows\\System32\\"))
else emptyList()

val output = Bash.execute(cmd, path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal fun parseSwiftTests(binary: String): List<String> {
}

val path = if (isWindows) {
listOf(Pair("Path", "$appDataDirectory\\.flank\\"), Pair("LD_LIBRARY_PATH", "$appDataDirectory\\.flank\\"))
listOf(Pair("Path", "$appDataDirectory\\.flank\\;C:\\Windows\\System32\\"), Pair("LD_LIBRARY_PATH", "$appDataDirectory\\.flank\\"))
} else emptyList()

// https://github.com/linkedin/bluepill/blob/37e7efa42472222b81adaa0e88f2bd82aa289b44/Source/Shared/BPXCTestFile.m#L17-18
Expand Down
9 changes: 7 additions & 2 deletions test_runner/src/main/kotlin/ftl/util/Bash.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ object Bash {
shellEnvironment: ShellEnvironment = ShellEnvironment.Default
): String {
logLn(cmd)
val process = ProcessBuilder(shellEnvironment.execution, "-c", cmd).also {
val process = ProcessBuilder(
shellEnvironment.execution,
if (isWindows) "/c"
else "-c",
cmd
).also {
if (additionalPath.isNotEmpty()) {
val envs: MutableMap<String, String> = it.environment()
additionalPath.forEach { extra ->
Expand All @@ -36,5 +41,5 @@ sealed class ShellEnvironment(val execution: String) {
object Bash : ShellEnvironment("Bash.exe")
object BinBash : ShellEnvironment("/bin/bash")
object Cmd : ShellEnvironment("cmd.exe")
object Default : ShellEnvironment(if (isWindows) Bash.execution else BinBash.execution)
object Default : ShellEnvironment(if (isWindows) Cmd.execution else BinBash.execution)
}

0 comments on commit b1e55f8

Please sign in to comment.