aboutsummaryrefslogtreecommitdiff
path: root/recipes/jamvm/files/java-initial
blob: 1b27f8134a095dddb9f2e243ae8d47824e7323ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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}