Skip to content

Commit

Permalink
Fix executable paths on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
JD557 committed Jun 23, 2024
1 parent 4e4b42d commit dc2bb47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]

default:
just --list
Expand Down
9 changes: 7 additions & 2 deletions project/src/build.runner.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Locale

import scala.concurrent.duration.*

import fs2.*
Expand All @@ -22,6 +24,9 @@ sealed trait BuildTool
class ScalaCli extends BuildTool
class Mill extends BuildTool

private lazy val isWindows: Boolean =
System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows")

def buildRunner(
tool: BuildTool,
linkingTopic: Topic[IO, Unit],
Expand Down Expand Up @@ -66,7 +71,7 @@ def buildRunnerScli(
.flatMap(
_ =>
ProcessBuilder(
"scala-cli",
if isWindows then "scala-cli.bat" else "scala-cli",
scalaCliArgs
).withWorkingDirectory(workDir)
.spawn[IO]
Expand Down Expand Up @@ -135,7 +140,7 @@ def buildRunnerMill(
) ++ extraBuildArgs
// TODO pipe this to stdout so that we can see linker progress / errors.
val builder = ProcessBuilder(
"mill",
if isWindows then "mill.bat" else "mill",
millargs
).withWorkingDirectory(workDir)
.spawn[IO]
Expand Down

0 comments on commit dc2bb47

Please sign in to comment.