]>
Commit | Line | Data |
---|---|---|
416331ca XL |
1 | #!/bin/bash -x |
2 | ||
3 | output=$(mktemp) | |
4 | ||
e1599b0c XL |
5 | mkdir -p book/ |
6 | cp -r $HOME/linkcheck/ book/ | |
7 | RUST_LOG=mdbook_linkcheck=debug mdbook-linkcheck -s 2>&1 | tee -a $output | |
8 | cp -r book/linkcheck $HOME/ | |
9 | ||
10 | mdbook build | |
416331ca XL |
11 | |
12 | result=${PIPESTATUS[0]} | |
13 | ||
14 | # if passed, great! | |
15 | if [ "$result" -eq "0" ] ; then | |
16 | exit 0 ; | |
17 | fi | |
18 | ||
19 | errors=$(cat $output | sed -n 's/There \(was\|were\) \([0-9]\+\).*$/\2/p') | |
20 | timeouts=$(cat $output | grep "error while fetching" | wc -l) | |
21 | ||
22 | # if all errors are timeouts, ignore them... | |
23 | if [ "$errors" -eq "$timeouts" ] ; then | |
24 | echo "Ignoring $timeouts timeouts"; | |
25 | exit 0; | |
26 | else | |
27 | echo "Non-timeout errors found"; | |
28 | exit 1; | |
29 | fi |