From 7450510327ef203bae866d9690d111f526aa61a6 Mon Sep 17 00:00:00 2001 From: Gautham Warrier Date: Sat, 7 Nov 2020 21:00:08 +0530 Subject: [PATCH] perf(init): use $RANDOM env-var instead of starship session to generate session-key (#1755) --- src/init/starship.bash | 4 +++- src/init/starship.zsh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/init/starship.bash b/src/init/starship.bash index f7bd2d9d..a51b7c2d 100644 --- a/src/init/starship.bash +++ b/src/init/starship.bash @@ -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. diff --git a/src/init/starship.zsh b/src/init/starship.zsh index a01844bd..0c25121a 100644 --- a/src/init/starship.zsh +++ b/src/init/starship.zsh @@ -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.