-
-
Notifications
You must be signed in to change notification settings - Fork 158
Fix macOS compatibility in tools/log.sh #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,14 +5,18 @@ CASENAME="$(pwd | xargs basename)" | |
| LOGFILE="$CASENAME.log" | ||
| export LOGFILE | ||
|
|
||
| STARTDATE="$(date --rfc-email)" | ||
| rfc_email_date() { | ||
| date --rfc-email 2>/dev/null || date '+%a, %d %b %Y %H:%M:%S %z' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
| } | ||
|
|
||
| STARTDATE="$(rfc_email_date)" | ||
| STARTTIME="$(date +%s)" | ||
| echo "Started on: $STARTDATE" | tee "$CASENAME.log" 2>&1 | ||
|
|
||
| close_log() { | ||
| echo "Started on: $STARTDATE" | tee --append "$LOGFILE" 2>&1 | ||
| ENDDATE="$(date --rfc-email)" | ||
| echo "Started on: $STARTDATE" | tee -a "$LOGFILE" 2>&1 | ||
| ENDDATE="$(rfc_email_date)" | ||
| ENDTIME="$(date +%s)" | ||
| echo "Finished on: $ENDDATE" | tee --append "$LOGFILE" 2>&1 | ||
| echo "Duration: $((ENDTIME-STARTTIME)) seconds (wall-clock time, including time waiting for participants)" | tee --append "$LOGFILE" 2>&1 | ||
| echo "Finished on: $ENDDATE" | tee -a "$LOGFILE" 2>&1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's wrong with I don't have a macOS system to test on, but this page, for example, suggests that both are valid. |
||
| echo "Duration: $((ENDTIME-STARTTIME)) seconds (wall-clock time, including time waiting for participants)" | tee -a "$LOGFILE" 2>&1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you post some example output from this script, to see the format and the computed time? |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
rfc_email_datedirectly refers to the implementation options (--rfc-email), which is the non-portable part. A more general name would be better.