Merge pull request #3615 from cunei/wip-npm

Print npm output, handle exit code in case of errors
This commit is contained in:
Dale Wijnand 2017-10-06 08:41:31 +01:00 committed by GitHub
commit b546eb215e
1 changed files with 6 additions and 2 deletions

View File

@ -427,19 +427,23 @@ lazy val vscodePlugin = (project in file("vscode-sbt-scala"))
skip in publish := true,
compile in Compile := {
val u = update.value
val log = streams.value.log
import sbt.internal.inc.Analysis
import scala.sys.process._
Process(s"npm run compile", Option(baseDirectory.value)).!
val exitCode = Process(s"npm run compile", Option(baseDirectory.value)) ! log
if (exitCode != 0) throw new Exception("Process returned exit code: " + exitCode)
Analysis.empty
},
update := {
val old = update.value
val t = target.value / "updated"
val base = baseDirectory.value
val log = streams.value.log
if (t.exists) ()
else {
import scala.sys.process._
Process("npm install", Option(base)).!
val exitCode = Process("npm install", Option(base)) ! log
if (exitCode != 0) throw new Exception("Process returned exit code: " + exitCode)
IO.touch(t)
}
old