Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: Fix shell script run under Windows OS #1461

Merged
merged 3 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import com.github.eikek.sbt.openapi._
import scala.sys.process._
import com.typesafe.sbt.SbtGit.GitKeys._
import docspell.build._
import de.heikoseeberger.sbtheader.CommentBlockCreator
Expand Down Expand Up @@ -997,13 +996,12 @@ def compileElm(
logger.info("Compile elm files ...")
val target =
outBase / "META-INF" / "resources" / "webjars" / artifact / version / "docspell-app.js"
val cmd = Seq("elm", "make") ++ mode.flags ++ Seq("--output", target.toString)
val proc = Process(
cmd ++ Seq(wd / "src" / "main" / "elm" / "Main.elm").map(_.toString),
Some(wd)
)
val out = proc.!!
logger.info(out)
val cmd = (Seq("elm", "make")
++ mode.flags
++ Seq("--output", target.toString)
++ Seq(wd / "src" / "main" / "elm" / "Main.elm").map(_.toString)
)
Cmd.run(cmd, wd, logger)
val targetGZ = file(target.toString + ".gz")
IO.gzip(target, targetGZ)
Seq(target, targetGZ)
Expand Down
7 changes: 6 additions & 1 deletion project/Cmd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ object Cmd {
}

def exec(cmd: Seq[String], wd: Option[File]): Result = {
val command =
sys.props.get("os.name").getOrElse("").toLowerCase match {
arittner marked this conversation as resolved.
Show resolved Hide resolved
case win if win.startsWith("windows") => Seq ("cmd", "/C") ++ cmd
case _ => cmd
}
val capt = new Capture
val rc = Process(cmd, wd).!(capt.logger)
val rc = Process(command, wd).!(capt.logger)
Result(rc, capt.out.get.mkString("\n"), capt.err.get.mkString("\n"))
}

Expand Down