File: functions.sh

package info (click to toggle)
weborf 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,152 kB
  • sloc: sh: 5,272; ansic: 3,505; python: 762; makefile: 119; xml: 44
file content (29 lines) | stat: -rwxr-xr-x 501 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Helper script, does nothing.
set -mex
cd $(dirname $0)

if [ -n "$AUTOPKGTEST_TMP" ]; then
    # Run system weborf in autopkgtest
    BINNAME=weborf
else
    BINNAME=../weborf
fi

function cleanup () {
    if [[ -n "$WEBORF_PID" ]]; then
        kill -9 "$WEBORF_PID"
    fi
}
trap cleanup EXIT


function run_weborf () {
    "$BINNAME" $@ &
    WEBORF_PID=$(jobs -p)

    sleep 0.2
    # Wait for it to be ready
    if [[ $(ls /proc/$WEBORF_PID/fd/ | wc -l) -lt 4 ]]; then
        sleep 2
    fi
}