File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,26 @@ function find_jar {
34
34
echo " $artifact "
35
35
}
36
36
37
+ # Log used to communicate errors from a command substitution, for example:
38
+ # $(sbt package || (echo msg >> $ERROR_LOG; kill -SIGTERM $$))
39
+ ERROR_LOG=error.log
40
+ trap onTerminate SIGTERM
41
+
42
+ onTerminate () {
43
+ if [ -f $ERROR_LOG ]; then
44
+ cat $ERROR_LOG
45
+ rm -f $ERROR_LOG
46
+ fi
47
+ exit 1 # $? is lost from subprocess in command substitution.
48
+ }
49
+
37
50
function build_jar {
38
51
# Usage:
39
52
# build_jar package path/to/jar/dir ['/some/sed/command']
40
53
#
41
54
# Last arg is optional
42
55
cd $DOTTY_ROOT >& /dev/null
43
- local build_output=$( sbt " $1 " )
56
+ local build_output=$( sbt " $1 " || (echo " failed to run: sbt $1 " >> $ERROR_LOG ; kill -SIGTERM $$ ) )
44
57
local jar=$( echo $build_output | sed -n ' s/.*Packaging //g; s/ \.\.\..*//g; /^\/.*/p' )
45
58
46
59
local sedjar=" $3 "
You can’t perform that action at this time.
0 commit comments