aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/jamvm/files/java-initial
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/jamvm/files/java-initial')
-rwxr-xr-xrecipes-core/jamvm/files/java-initial17
1 files changed, 17 insertions, 0 deletions
diff --git a/recipes-core/jamvm/files/java-initial b/recipes-core/jamvm/files/java-initial
new file mode 100755
index 0000000..1b27f81
--- /dev/null
+++ b/recipes-core/jamvm/files/java-initial
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Wrapper which (almost) silently restarts the VM in case of segfaults.
+
+error_counter=0;
+error_occured=139
+while [ ${error_counter} -le 50 -a ${error_occured} -eq 139 ]; do
+ echo "Running JamVM-initial: ${@}"
+ jamvm-initial ${1+"$@"}
+ error_occured=$?
+ if [ ${error_occured} -eq 139 ]; then
+ echo "JamVM-initial crashed - silently trying again"
+ error_counter=$(( $error_counter + 1 ))
+ fi
+done
+
+exit ${error_occured}