Skip to content

Commit

Permalink
fix(bash): fallback TIMER_START to HOME
Browse files Browse the repository at this point in the history
resolves #802
  • Loading branch information
JanDeDobbeleer committed Jun 12, 2021
1 parent 3ec46f4 commit 08c0d9a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/init/omp.bash
Expand Up @@ -4,14 +4,19 @@ export CONDA_PROMPT_MODIFIER=false

TIMER_START="/tmp/${USER}.start.$$"

PS0='$(::OMP:: --millis > $TIMER_START)'
# some environments don't have the filesystem we'd expect
if [[ ! -d "/tmp" ]]; then
TIMER_START="${HOME}/.${USER}.start.$$"
fi

PS0='$(::OMP:: --millis > $TIMER_START)'

function _omp_hook() {
local ret=$?

omp_stack_count=$((${#DIRSTACK[@]} - 1))
omp_elapsed=-1
if [[ -f $TIMER_START ]]; then
if [[ -f "$TIMER_START" ]]; then
omp_now=$(::OMP:: --millis)
omp_start_time=$(cat "$TIMER_START")
omp_elapsed=$((omp_now-omp_start_time))
Expand Down

0 comments on commit 08c0d9a

Please sign in to comment.