-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
shell_(parse|split|escape): fix some issues with deprecation #19985
Conversation
StefanKarpinski
commented
Jan 11, 2017
- shell_parse needed a special keyword arg but didn't have one
- seems better to have shell_split and shell_escape default to not having any special shell characters
- instead the usages of shell_parse in the implementation of the backticks syntax supplies the now-special shell characters and the corresponding use of shell_escape when displaying them too
* shell_parse needed a special keyword arg but didn't have one * seems better to have shell_split and shell_escape default to _not_ having any special shell characters * instead the usages of shell_parse in the implementation of the backticks syntax supplies the now-special shell characters and the corresponding use of shell_escape when displaying them too
See #19786. cc: @amitmurthy, @tkelman. This addresses your concerns from that PR by making |
|
||
The unexported `shell_escape` function is the inverse of the unexported `shell_split` function: | ||
it takes a string or command object and escapes any special characters in such a way that calling | ||
`shell_split` on it would give back the array of words in the original command. The `special` | ||
keyword argument controls what characters in addition to whitespace, backslashes, quotes and | ||
dollar signs are considered to be special. Examples: | ||
dollar signs are considered to be special (default: none). Examples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"in addition" isn't accurate any more then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is: whitespace, backslashes, quotes and dollar signs are always considered special; the special
keyword allows you to supply a string of characters that are also considered special.
@@ -4,7 +4,15 @@ | |||
|
|||
const shell_special = "#{}()[]<>|&*?~;" | |||
|
|||
function shell_parse(str::AbstractString, interpolate::Bool=true) | |||
# needs to be factored out so depwarn only warns once | |||
@noinline warn_shell_special(special) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the leading spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
editor playing tricks on me?
dollar signs are considered to be special (default: none). Examples: | ||
|
||
julia> Base.shell_escape("cat", "/foo/bar baz", "&&", "echo", "done") | ||
"cat '/foo/bar baz' && echo done" | ||
|
||
julia> Base.shell_escape("echo", "this", "&&", "that") | ||
"echo this '&&' that" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer displays with quotes around the &&
, and these should be doctests so this would have been noticed sooner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make a PR to fix it.