mirror of
https://github.com/powerline/powerline.git
synced 2025-07-25 23:05:32 +02:00
Remove "$()" method in pre-prompt hook
Using "$()" method on pre-prompt hook is just asking for security trouble.
This commit is contained in:
parent
99158e3ef2
commit
8dd5aeb09d
@ -1,8 +1,3 @@
|
|||||||
_powerline_prompt_command() {
|
|
||||||
export PS1="$(powerline-prompt --last_exit_code=$? left)"
|
|
||||||
_powerline_tmux_set_pwd
|
|
||||||
}
|
|
||||||
|
|
||||||
_powerline_tmux_setenv() {
|
_powerline_tmux_setenv() {
|
||||||
if [[ -n "$TMUX" ]]; then
|
if [[ -n "$TMUX" ]]; then
|
||||||
tmux setenv TMUX_"$1"_$(tmux display -p "#D" | tr -d %) "$2"
|
tmux setenv TMUX_"$1"_$(tmux display -p "#D" | tr -d %) "$2"
|
||||||
@ -20,4 +15,5 @@ _powerline_tmux_set_columns() {
|
|||||||
trap "_powerline_tmux_set_columns" SIGWINCH
|
trap "_powerline_tmux_set_columns" SIGWINCH
|
||||||
kill -SIGWINCH "$$"
|
kill -SIGWINCH "$$"
|
||||||
|
|
||||||
export PROMPT_COMMAND="_powerline_prompt_command"
|
export PROMPT_COMMAND="_powerline_tmux_set_pwd"
|
||||||
|
PS1='$(powerline-prompt --last_exit_code=$? left)'
|
||||||
|
@ -36,3 +36,7 @@ class ShellRenderer(Renderer):
|
|||||||
if attr & Renderer.ATTR_BOLD:
|
if attr & Renderer.ATTR_BOLD:
|
||||||
ansi += [1]
|
ansi += [1]
|
||||||
return '[{0}m'.format(';'.join(str(attr) for attr in ansi))
|
return '[{0}m'.format(';'.join(str(attr) for attr in ansi))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def escape(string):
|
||||||
|
return string.replace('\\', '\\\\')
|
||||||
|
@ -15,4 +15,4 @@ class ZshPromptRenderer(ShellRenderer):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def escape(string):
|
def escape(string):
|
||||||
return string.replace('%', '%%')
|
return string.replace('%', '%%').replace('\\', '\\\\')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user