From 96b476f1364f1a632460ffe756f6ef6e77bc4116 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Fri, 6 Oct 2017 02:26:59 +0200 Subject: [PATCH] Print npm output, handle exit code in case of errors --- build.sbt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 2a16a7065..93f3e3576 100644 --- a/build.sbt +++ b/build.sbt @@ -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