aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-06-20 23:55:14 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-06-20 23:55:14 +0300
commitbda3171237e83ab7fd47d5b2fa6c2d3f44f02e92 (patch)
treea9f44d94add0c8a83cac53dc904404b8e2e5100a /powerlevel9k.zsh-theme
parent8c0df73d81149ac3346e4ced3dd769db1d05b74a (diff)
Fix java_version segment
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme7
1 files changed, 6 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 05a75489..ff3a9466 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -1713,7 +1713,12 @@ prompt_dropbox() {
# print Java version number
prompt_java_version() {
local java_version
- java_version=$(java -fullversion 2>/dev/null | cut -d '"' -f 2)
+ # Stupid: Java prints its version on STDERR.
+ # The first version ouput will print nothing, we just
+ # use it to transport whether the command was successful.
+ # If yes, we parse the version string (and need to
+ # redirect the stderr to stdout to make the pipe work).
+ java_version=$(java -version 2>/dev/null && java -fullversion 2>&1 | cut -d '"' -f 2)
if [[ -n "$java_version" ]]; then
"$1_prompt_segment" "$0" "$2" "red" "white" "$java_version" "JAVA_ICON"