1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-30 05:23:50 +03:00
Files
mariadb/BUILD/capture_warnings.sh
kevg b98f09fcbf Scripts: Three modes of warning printing.
WARN_MODE=early
print warnings at compilation stage

WARN_MODE=late
print warnings at build finish stage

WARN_MODE=both
print both at early and at later stages
2017-05-05 20:36:18 +03:00

21 lines
369 B
Bash
Executable File

#!/bin/bash
warn_path=$1
warn_mode=$2
shift 2
warn_file="$warn_path/compile.warnings"
suppress_file="$warn_path/suppress.warnings"
exec 3>&1
cmderr=$("$@" 2>&1 1>&3)
error=$?
if [[ -n "$cmderr" ]]; then
[[ "$warn_mode" == "both" ]] &&
echo "$cmderr" >&2
[[ "$cmderr" =~ warning:(.+)$ ]] &&
echo -n "$cmderr" >> "$warn_file"
fi
exit ${error}