diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2020-03-08 17:43:25 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2020-03-08 17:43:25 +0300 |
commit | 2db72dad1f6643a313f871bd66518f76f3dc796d (patch) | |
tree | 640fffb6a5f60f9e705caec3eb9e2fa8498e6545 /internal/p10k.zsh | |
parent | a082a04624659d56c1d8962c8732f97bee4904bd (diff) |
speed up detect_virt segment by 50% (now takes 2 ms instead of 3 ms)
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r-- | internal/p10k.zsh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 10b3ce16..5034f0ee 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -2058,7 +2058,10 @@ prompt_history() { prompt_detect_virt() { local virt="$(systemd-detect-virt 2>/dev/null)" if [[ "$virt" == "none" ]]; then - [[ "$(ls -di /)" != "2 /" ]] && virt="chroot" + local -a inode + if zstat -A inode +inode / 2>/dev/null && [[ $inode[1] != 2 ]]; then + virt="chroot" + fi fi if [[ -n "${virt}" ]]; then _p9k_prompt_segment "$0" "$_p9k_color1" "yellow" '' 0 '' "${virt//\%/%%}" |