aboutsummaryrefslogtreecommitdiffstats
path: root/development/run-ganache
blob: 794a350841ed22955d1b135710567e4242ed1c0b (plain) (blame)
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
#!/usr/bin/env bash

set -e
set -u
set -o pipefail

ganache_cli="$(npm bin)/ganache-cli"
seed_phrase="${GANACHE_SEED_PHRASE:-phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent}"

_term () {
    printf '%s\n' "Received SIGTERM, sending SIGKILL to Ganache"
    kill -KILL "$child" 2>/dev/null
    exit 42
}

_int () {
    printf '%s\n' "Received SIGINT, sending SIGKILL to Ganache"
    kill -KILL "$child" 2>/dev/null
    exit 42
}

trap _term SIGTERM
trap _int SIGINT

$ganache_cli --noVMErrorsOnRPCResponse --networkId 5777 --mnemonic "$seed_phrase" ${GANACHE_ARGS:-} &

child=$!
wait "$child"