File: common_functions.sh

package info (click to toggle)
mfgtools 1.5.239-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,296 kB
  • sloc: cpp: 10,087; javascript: 546; python: 335; sh: 85; xml: 53; makefile: 18
file content (29 lines) | stat: -rwxr-xr-x 772 bytes parent folder | download
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
#!/bin/bash

log_and_run() {
    echo "[INFO] $1"
    shift
    "$@"
}

dump_logs() {
    echo "=== DUMPING ALL AVAILABLE LOGS ==="
    
    # vcpkg logs
    if [ -d "/tmp/vcpkg/buildtrees" ]; then
        find /tmp/vcpkg/buildtrees -name "*.log" -print0 | while IFS= read -r -d '' logfile; do
            echo "=== LOG: $logfile ==="
            cat "$logfile" 2>/dev/null || echo "Could not read $logfile"
            echo "=== END LOG ==="
        done
    fi
    
    # Project build logs
    if [ -d "build" ]; then
        find build -name "*.log" -print0 | while IFS= read -r -d '' logfile; do
            echo "=== LOG: $logfile ==="
            cat "$logfile" 2>/dev/null || echo "Could not read $logfile"
            echo "=== END LOG ==="
        done
    fi
}