mirror of
https://github.com/levogevo/ffmpeg-builder.git
synced 2026-01-15 19:06:17 +00:00
initial working ffmpeg static/shared
This commit is contained in:
35
scripts/common.sh
Normal file
35
scripts/common.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
# ANSI colors
|
||||
RED='\e[0;31m'
|
||||
CYAN='\e[0;36m'
|
||||
GREEN='\e[0;32m'
|
||||
YELLOW='\e[0;33m'
|
||||
NC='\e[0m'
|
||||
|
||||
# echo wrappers
|
||||
echo_fail() { echo -e "${RED}FAIL${NC}:" "$@" ; }
|
||||
echo_info() { echo -e "${CYAN}INFO${NC}:" "$@" ; }
|
||||
echo_pass() { echo -e "${GREEN}PASS${NC}:" "$@" ; }
|
||||
echo_warn() { echo -e "${YELLOW}WARN${NC}:" "$@" ; }
|
||||
echo_exit() { echo_fail "$@" ; exit 1 ; }
|
||||
|
||||
echo_if_fail() {
|
||||
local cmd=("$@")
|
||||
local out="/tmp/.stdout-${RANDOM}"
|
||||
local err="/tmp/.stderr-${RANDOM}"
|
||||
"${cmd[@]}" > ${out} 2> ${err}
|
||||
local retval=$?
|
||||
if ! test ${retval} -eq 0; then
|
||||
echo
|
||||
echo_fail "command [" "${cmd[@]}" "] failed"
|
||||
echo_warn "command output:"
|
||||
tail -n 10 ${out}
|
||||
tail -n 10 ${err}
|
||||
echo
|
||||
fi
|
||||
rm ${out} ${err}
|
||||
return ${retval}
|
||||
}
|
||||
Reference in New Issue
Block a user