From d66a13a35474ef982b64ac441e6f7e9e84ca6bf9 Mon Sep 17 00:00:00 2001 From: Hans Kristian Flaatten Date: Tue, 9 Aug 2022 13:02:44 +0200 Subject: [PATCH] Detect what version of python is installed --- functions/__kube_prompt.fish | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/__kube_prompt.fish b/functions/__kube_prompt.fish index dc2be49..25d0c26 100644 --- a/functions/__kube_prompt.fish +++ b/functions/__kube_prompt.fish @@ -22,10 +22,13 @@ function __kube_ps_update_cache end function __stat_mtime + # Get installed python executable + set python (which -a python python2 python2.7 python3 python3.6 | head -n 1) + #-- cross-platform workaround; POSIX didn't specify stat(1) and so #-- its interface is incompatibly different on Mac OS and Linux. #-- see https://unix.stackexchange.com/q/561927/3097 - python -c "print(__import__('os').stat(__import__('sys').argv[1]).st_mtime)" $argv + $python -c "print(__import__('os').stat(__import__('sys').argv[1]).st_mtime)" $argv end set -l kubeconfig "$KUBECONFIG"