aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorÓlafur Páll Geirsson <olafurpg@gmail.com>2016-08-02 19:17:38 +0200
committerÓlafur Páll Geirsson <olafurpg@gmail.com>2016-08-02 19:28:41 +0200
commitb2186e3f07bf8c16961760503920ecff8d21751e (patch)
tree259145fa5622b8d321fe0a4d97a76b31c6c848bc /bin
parent01bd9482d6d1565bfeb17526bed836f0feaeb0d1 (diff)
downloaddotty-b2186e3f07bf8c16961760503920ecff8d21751e.tar.gz
dotty-b2186e3f07bf8c16961760503920ecff8d21751e.tar.bz2
dotty-b2186e3f07bf8c16961760503920ecff8d21751e.zip
Fix #1437: handle build failure in bin/dotc.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/common15
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/common b/bin/common
index aa3fc1af6..92e4dcdb3 100755
--- a/bin/common
+++ b/bin/common
@@ -34,13 +34,26 @@ function find_jar {
echo "$artifact"
}
+# Log used to communicate errors from a command substitution, for example:
+# $(sbt package || (echo msg >> $ERROR_LOG; kill -SIGTERM $$))
+ERROR_LOG=error.log
+trap onTerminate SIGTERM
+
+onTerminate() {
+ if [ -f $ERROR_LOG ]; then
+ cat $ERROR_LOG
+ rm -f $ERROR_LOG
+ fi
+ exit 1 # $? is lost from subprocess in command substitution.
+}
+
function build_jar {
# Usage:
# build_jar package path/to/jar/dir ['/some/sed/command']
#
# Last arg is optional
cd $DOTTY_ROOT >& /dev/null
- local build_output=$(sbt "$1")
+ local build_output=$(sbt "$1" || (echo "failed to run: sbt $1" >> $ERROR_LOG; kill -SIGTERM $$))
local jar=$(echo $build_output | sed -n 's/.*Packaging //g; s/ \.\.\..*//g; /^\/.*/p')
local sedjar="$3"