Skip to content

Commit

Permalink
perf(init): use $RANDOM env-var instead of starship session to genera…
Browse files Browse the repository at this point in the history
…te session-key (starship#1755)
  • Loading branch information
Gautham authored Nov 7, 2020
1 parent 30db07a commit 7450510
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/init/starship.bash
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,6 @@ STARSHIP_START_TIME=$(::STARSHIP:: time)
export STARSHIP_SHELL="bash"

# Set up the session key that will be used to store logs
export STARSHIP_SESSION_KEY=$(::STARSHIP:: session)
STARSHIP_SESSION_KEY="$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM"; # Random generates a number b/w 0 - 32767
STARSHIP_SESSION_KEY="${STARSHIP_SESSION_KEY}0000000000000000" # Pad it to 16+ chars.
export STARSHIP_SESSION_KEY=${STARSHIP_SESSION_KEY:0:16}; # Trim to 16-digits if excess.
4 changes: 3 additions & 1 deletion src/init/starship.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ STARSHIP_START_TIME=$(::STARSHIP:: time)
export STARSHIP_SHELL="zsh"

# Set up the session key that will be used to store logs
export STARSHIP_SESSION_KEY=$(::STARSHIP:: session)
STARSHIP_SESSION_KEY="$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM"; # Random generates a number b/w 0 - 32767
STARSHIP_SESSION_KEY="${STARSHIP_SESSION_KEY}0000000000000000" # Pad it to 16+ chars.
export STARSHIP_SESSION_KEY=${STARSHIP_SESSION_KEY:0:16}; # Trim to 16-digits if excess.

0 comments on commit 7450510

Please sign in to comment.