bug: Use en_US when fetching EPOCHREALTIME
Isolates fetching of EPOCHREALTIME to a function which sets LC_ALL=en_US.UTF-8. This ensures that the value is in decimal format, regardless of runtime locale. bug: Hide duration when no command executed
This commit is contained in:
@@ -9,7 +9,7 @@ function local_setup_file() {
|
||||
|
||||
@test "plugins cmd-returned-notify: notify after elapsed time" {
|
||||
export NOTIFY_IF_COMMAND_RETURNS_AFTER=0
|
||||
export COMMAND_DURATION_START_SECONDS="${EPOCHREALTIME:-$SECONDS}"
|
||||
export COMMAND_DURATION_START_SECONDS="$(_shell_duration_en)"
|
||||
sleep 1
|
||||
run precmd_return_notification
|
||||
assert_success
|
||||
@@ -18,7 +18,7 @@ function local_setup_file() {
|
||||
|
||||
@test "plugins cmd-returned-notify: do not notify before elapsed time" {
|
||||
export NOTIFY_IF_COMMAND_RETURNS_AFTER=10
|
||||
export COMMAND_DURATION_START_SECONDS="${EPOCHREALTIME:-$SECONDS}"
|
||||
export COMMAND_DURATION_START_SECONDS="$(_shell_duration_en)"
|
||||
sleep 1
|
||||
run precmd_return_notification
|
||||
assert_success
|
||||
@@ -34,7 +34,7 @@ function local_setup_file() {
|
||||
@test "lib command_duration: preexec set COMMAND_DURATION_START_SECONDS" {
|
||||
export COMMAND_DURATION_START_SECONDS=
|
||||
assert_equal "${COMMAND_DURATION_START_SECONDS}" ""
|
||||
NOW="${EPOCHREALTIME:-$SECONDS}"
|
||||
NOW="$(_shell_duration_en)"
|
||||
_command_duration_pre_exec
|
||||
# We need to make sure to account for nanoseconds...
|
||||
assert_equal "${COMMAND_DURATION_START_SECONDS%.*}" "${NOW%.*}"
|
||||
|
||||
Reference in New Issue
Block a user