summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-02-11 23:54:29 +0000
committerPaul Phillips <paulp@improving.org>2011-02-11 23:54:29 +0000
commit02fd6b6139dce48fffe46785fb6b588690885b26 (patch)
tree5f6aaa9806ca9536ccaa464452fc6a0265e3e58c /src/compiler/scala/tools/ant/templates/tool-unix.tmpl
parent593256a6ecc799e10cd6079a61e713aede854106 (diff)
downloadscala-02fd6b6139dce48fffe46785fb6b588690885b26.tar.gz
scala-02fd6b6139dce48fffe46785fb6b588690885b26.tar.bz2
scala-02fd6b6139dce48fffe46785fb6b588690885b26.zip
I chased a lot of ghosts before finding the rea...
I chased a lot of ghosts before finding the real culprit for why partest failures have been unfailing. Process(Seq("bash", "-c", "exit 42")) ! // 42 Process(Seq("bash", "-c", "exit 42")) #> logFile ! // 0 That behavior is not yet fixed, but I altered partest not to use #> and fixed the test which should have been failing but wasn't. Closes #4227, no review.
Diffstat (limited to 'src/compiler/scala/tools/ant/templates/tool-unix.tmpl')
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-unix.tmpl29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
index 92852cc5de..21b0bd7b39 100644
--- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
@@ -8,25 +8,29 @@
# PARTICULAR PURPOSE.
##############################################################################
-function onExit() {
- if [[ -n "$scaladebug" ]]; then
- echo "scala script runner trapped exit, running handler."
- fi
-
- local exit_status=${1:-$?}
+# Not sure what the right default is here: trying nonzero.
+SCALA_EXIT_STATUS=127
+REENABLE_ECHO=true
+function reenableEcho() {
+ REENABLE_ECHO=false
# reenable echo
case "$TERM" in
rxvt* | xterm* | screen*)
stty icanon echo
;;
esac
-
- exit $exit_status
}
-# install exit handler
-trap onExit EXIT
+function onExit() {
+ if $REENABLE_ECHO; then
+ reenableEcho
+ exit $SCALA_EXIT_STATUS
+ fi
+}
+
+# to reenable echo if we are interrupted before completing.
+trap onExit INT
cygwin=false;
case "`uname`" in
@@ -138,3 +142,8 @@ fi
-Denv.emacs="$EMACS" \
$CYGWIN_JLINE_TERMINAL \
@properties@ @class@ @toolflags@ "$@@"
+
+# record the exit status lest it be overwritten:
+# then reenable echo and propagate the code.
+SCALA_EXIT_STATUS=$?
+onExit