Commit d221b1a4 authored by Vitaly Lipatov's avatar Vitaly Lipatov

common: skip script without tty

parent dd0d945e
...@@ -134,7 +134,7 @@ do ...@@ -134,7 +134,7 @@ do
LOGFILE="$LOGDIR/`basename $NAMESRPMIN .src.rpm`$MENVARG.log" LOGFILE="$LOGDIR/`basename $NAMESRPMIN .src.rpm`$MENVARG.log"
rm -f $LOGFILE $LOGFILE.ok rm -f $LOGFILE $LOGFILE.ok
#echo "Build in native system" >$LOGFILE #echo "Build in native system" >$LOGFILE
(faketty "$ETERBUILDBIN/rpmeterbuild rpmbuild --commit $ln -bb $LISTRPMARGS $NODEPS --target $BUILDARCH" && touch $LOGFILE.ok) 2>&1 | tee >(stripcolors >> $LOGFILE) (faketty "$ETERBUILDBIN/rpmeterbuild" rpmbuild --commit "$ln" -bb $LISTRPMARGS $NODEPS --target "$BUILDARCH" && touch $LOGFILE.ok) 2>&1 | tee >(stripcolors >> $LOGFILE)
[ -r "$LOGFILE.ok" ] [ -r "$LOGFILE.ok" ]
RET=$? RET=$?
......
...@@ -24,10 +24,15 @@ fi ...@@ -24,10 +24,15 @@ fi
# Run command in a fake tty to preserve colored output through pipes # Run command in a fake tty to preserve colored output through pipes
# Usage: faketty "command with arguments" # Usage: faketty command [args...]
faketty() faketty()
{ {
script -q -e -c "$*" /dev/null # script(1) requires a real tty on stdin; fall back in non-tty contexts.
if test -t 0; then
script -q -e -c "$*" /dev/null
else
"$@"
fi
} }
# Strip ANSI color codes and OSC 8 hyperlinks from input # Strip ANSI color codes and OSC 8 hyperlinks from input
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment