fix(bash): escape executable
Some checks are pending
Code QL / code-ql (push) Waiting to run
Release / changelog (push) Waiting to run
Release / artifacts (push) Blocked by required conditions

resolves #5496
This commit is contained in:
Jan De Dobbeleer 2024-08-22 11:09:38 +00:00
parent dde2064ea1
commit 7486558436
3 changed files with 9 additions and 9 deletions

View file

@ -10,11 +10,6 @@ import (
//go:embed scripts/omp.bash //go:embed scripts/omp.bash
var bashInit string var bashInit string
const (
unixUpgrade = "$_omp_executable upgrade"
unixNotice = "$_omp_executable notice"
)
func (f Feature) Bash() Code { func (f Feature) Bash() Code {
switch f { switch f {
case CursorPositioning: case CursorPositioning:
@ -22,9 +17,9 @@ func (f Feature) Bash() Code {
case FTCSMarks: case FTCSMarks:
return "_omp_ftcs_marks=1" return "_omp_ftcs_marks=1"
case Upgrade: case Upgrade:
return unixUpgrade return `"$_omp_executable" upgrade`
case Notice: case Notice:
return unixNotice return `"$_omp_executable" notice`
case PromptMark, RPrompt, PoshGit, Azure, LineError, Jobs, Tooltips, Transient: case PromptMark, RPrompt, PoshGit, Azure, LineError, Jobs, Tooltips, Transient:
fallthrough fallthrough
default: default:

View file

@ -11,8 +11,8 @@ func TestBashFeatures(t *testing.T) {
want := `// these are the features want := `// these are the features
_omp_ftcs_marks=1 _omp_ftcs_marks=1
$_omp_executable upgrade "$_omp_executable" upgrade
$_omp_executable notice "$_omp_executable" notice
_omp_cursor_positioning=1` _omp_cursor_positioning=1`
assert.Equal(t, want, got) assert.Equal(t, want, got)

View file

@ -7,6 +7,11 @@ import (
//go:embed scripts/omp.zsh //go:embed scripts/omp.zsh
var zshInit string var zshInit string
const (
unixUpgrade = "$_omp_executable upgrade"
unixNotice = "$_omp_executable notice"
)
func (f Feature) Zsh() Code { func (f Feature) Zsh() Code {
switch f { switch f {
case CursorPositioning: case CursorPositioning: