-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per #1546, moved time_command function into a file to be sourced by e…
…ach script that needs to use it
- Loading branch information
1 parent
e85c79c
commit f2dbb7d
Showing
3 changed files
with
18 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#! /bin/bash | ||
|
||
# utility function to run command get log the time it took to run | ||
function time_command { | ||
local start_seconds=$SECONDS | ||
echo "RUNNING: $*" | ||
"$@" | ||
local error=$? | ||
|
||
local duration=$(( SECONDS - start_seconds )) | ||
echo "TIMING: Command took `printf '%02d' $(($duration / 60))`:`printf '%02d' $(($duration % 60))` (MM:SS): '$*'" | ||
if [ ${error} -ne 0 ]; then | ||
echo "ERROR: '$*' exited with status = ${error}" | ||
fi | ||
return $error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters