61
61
SED=cat
62
62
fi
63
63
64
+ timefile=" $logdir /$logname .time"
65
+ rm -f " $timefile "
66
+ if /usr/bin/time -p -o /dev/null true ; then
67
+ TIME=" /usr/bin/time -p -o $timefile "
68
+ else
69
+ TIME=" "
70
+ fi
71
+
64
72
mkdir -p " $logdir "
65
73
66
74
# Do all logging of child processes with V=1 to ensure that no
@@ -75,12 +83,15 @@ if [ -n "$SAGE_SILENT_BUILD" -a ${use_prefix} = true ]; then
75
83
# Silent build.
76
84
# Similar to https://www.gnu.org/software/automake/manual/html_node/Automake-Silent-Rules.html#Automake-Silent-Rules
77
85
echo " [$logname ] installing. Log file: $logfile "
78
- ( exec>> $logfile 2>&1 ; eval " $cmd " )
86
+ ( exec>> $logfile 2>&1 ; $TIME sh -c " $cmd " ; status=$? ;
87
+ [ -r $timefile ] && cat $timefile ; exit $status )
79
88
status=$?
80
89
if [[ $status != 0 ]]; then
81
90
echo " [$logname ] error installing, exit status $status . End of log file:"
82
91
tail -n 120 " $logfile " | sed " /Please email sage-devel/,$ d;s;^; [$logname ] ;" >&2
83
92
echo " [$logname ] Full log file: $logfile "
93
+ elif grep -q ' real [1-9][0-9]' $timefile 2> /dev/null; then # at least 10 seconds
94
+ echo " [$logname ] successfully installed ($( echo $( cat $timefile ) ) )."
84
95
else
85
96
echo " [$logname ] successfully installed."
86
97
fi
90
101
# We trap SIGINT such that SIGINT interrupts the main process being
91
102
# run, not the logging.
92
103
93
- ( exec 2>&1 ; eval " $cmd " ) | \
104
+ ( exec 2>&1 ;
105
+ $TIME sh -c " $cmd " ; status=$? ;
106
+ if grep -q ' real [1-9][0-9]' $timefile 2> /dev/null; then echo $( echo $( cat $timefile ) ) ; fi ;
107
+ exit $status ) | \
94
108
( trap ' ' SIGINT; if [ -n " $GITHUB_ACTIONS " -a -n " $prefix " ]; then echo " ::group::${logname} " ; fi ; tee -a " $logfile " | $SED ; if [ -n " $GITHUB_ACTIONS " -a -n " $prefix " ]; then echo " ::endgroup::" ; fi )
95
109
96
110
pipestatus=(${PIPESTATUS[*]} )
0 commit comments