-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bash params not work when pass special chars #366
Comments
Added simple escaping (take args in quotes), this will work almost for every case, but would fail if the argument contains a single quote. |
@melonamin FYI single-quoting all args seems to break a few things in my experience - in prior versions, it's valid to specify a param containing spaces by encapsulating it in quotes. But now, it causes the param to get double quoted, and breaks it. The most obvious example is when plugins use another bash subshell to run something more complicated:
That's a trivial example, but the bitbar/xbar plugin libraries contain real examples just like this, and I've run into this issue with my own plugins as well. I don't have a workaround at the moment - it's either impractical or impossible to break down these things to individual params (e.g. the above wouldn't work, you can't quote an individual pipe character). Unfortunately I don't think quoting all params is a workable solution |
Ok, broke faster than I expected... |
If you could avoid the double quoting (i.e. don't quote an already-quoted string, so that params containing spaces can still be used), it might work. There's varying degrees of sophistication you could apply - from full on shell lexical parsing (a bit like python's Maybe something like: let quotedStringRegex = #/^(?:'.*'|".*")$/#
return out.map {
if $0.firstMatch(of: quotedStringRegex) == nil {
"'\($0)'"
} else {
$0
}
} (My swift is terrible, but you get the idea) |
Signed-off-by: Alex Mazanov <alexandr.mazanov@gmail.com>
I've updated the logic a bit, check it out in the latest public release |
Probably related to: #308 |
Describe the bug
If plugin contains below line:
The terminal will show
syntax error
if$name
isabc(123)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
params should be passed to bash script correctly (in quote?)
Environment:
Plugin Example:
Additional Context:
when
name='abc (123)'
(a space in it), the code works, but not whenabc(123)
The text was updated successfully, but these errors were encountered: