Skip to content

Commit

Permalink
fix shell mode interpolation while allowing special chars in commands
Browse files Browse the repository at this point in the history
fixes #22176, see also #20494 and #20482
  • Loading branch information
StefanKarpinski committed Jun 17, 2017
1 parent ad290e9 commit bcb2640
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion base/REPL.jl
Expand Up @@ -750,7 +750,9 @@ function setup_interface(repl::LineEditREPL; hascolor = repl.hascolor, extra_rep
# and pass into Base.repl_cmd for processing (handles `ls` and `cd`
# special)
on_done = respond(repl, julia_prompt) do line
Expr(:call, :(Base.repl_cmd), Cmd(Base.shell_split(line)), outstream(repl))
Expr(:call, :(Base.repl_cmd),
:(Base.cmd_gen($(Base.shell_parse(line)[1]))),
outstream(repl))
end)


Expand Down
2 changes: 1 addition & 1 deletion base/process.jl
Expand Up @@ -793,7 +793,7 @@ function cmd_gen(parsed)
end

macro cmd(str)
return :(cmd_gen($(shell_parse(str, special=shell_special)[1])))
return :(cmd_gen($(esc(shell_parse(str, special=shell_special)[1]))))
end

wait(x::Process) = if !process_exited(x); stream_wait(x, x.exitnotify); end
Expand Down
2 changes: 1 addition & 1 deletion base/shell.jl
Expand Up @@ -75,7 +75,7 @@ function shell_parse(str::AbstractString, interpolate::Bool=true;
stpos = j
ex, j = parse(s,j,greedy=false)
last_parse = stpos:j
update_arg(esc(ex)); i = j
update_arg(ex); i = j
else
if !in_double_quotes && c == '\''
in_single_quotes = !in_single_quotes
Expand Down

0 comments on commit bcb2640

Please sign in to comment.