Fix: env cmd errors on Windows.

This commit is contained in:
Vincent Zhang 2018-07-30 11:43:41 +08:00
parent 8af6cb74f6
commit c159a5cd91

View file

@ -1151,15 +1151,15 @@ See `mode-line-percent-position'.")
;; Versions, support Python, Ruby and Golang ;; Versions, support Python, Ruby and Golang
(add-hook 'python-mode-hook (add-hook 'python-mode-hook
(lambda () (lambda ()
(when (executable-find "python") (when (and (executable-find "python") (executable-find "cut") (executable-find "sed"))
(setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2 | sed -n '1p'")))) (setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2 | sed -n '1p'"))))
(add-hook 'ruby-mode-hook (add-hook 'ruby-mode-hook
(lambda () (lambda ()
(when (executable-find "ruby") (when (and (executable-find "ruby") (executable-find "cut") (executable-find "sed"))
(setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2 | sed -n '1p'")))) (setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2 | sed -n '1p'"))))
(add-hook 'go-mode-hook (add-hook 'go-mode-hook
(lambda () (lambda ()
(when (executable-find "go") (when (and (executable-find "go") (executable-find "cut") (executable-find "tr") (executable-find "sed"))
(setq doom-modeline-env-command "go version 2>&1 | cut -d' ' -f3 | tr -d 'go' | sed -n '1p'")))) (setq doom-modeline-env-command "go version 2>&1 | cut -d' ' -f3 | tr -d 'go' | sed -n '1p'"))))