File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -386,5 +386,6 @@ Process(`echo 1`, ProcessExited(0))
386386```
387387"""
388388macro cmd (str)
389- return :(cmd_gen ($ (esc (shell_parse (str, special= shell_special)[1 ]))))
389+ cmd_ex = shell_parse (str, special= shell_special, filename= String (__source__. file))[1 ]
390+ return :(cmd_gen ($ (esc (cmd_ex))))
390391end
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ function rstrip_shell(s::AbstractString)
1616end
1717
1818function shell_parse (str:: AbstractString , interpolate:: Bool = true ;
19- special:: AbstractString = " " )
19+ special:: AbstractString = " " , filename = " none " )
2020 s:: SubString = SubString (str, firstindex (str))
2121 s = rstrip_shell (lstrip (s))
2222
@@ -69,7 +69,8 @@ function shell_parse(str::AbstractString, interpolate::Bool=true;
6969 # string interpolation syntax (see #3150)
7070 ex, j = :var , stpos+ 3
7171 else
72- ex, j = Meta. parse (s,stpos,greedy= false )
72+ # use parseatom instead of parse to respect filename (#28188)
73+ ex, j = Meta. parseatom (s, stpos, filename= filename)
7374 end
7475 last_parse = (stpos: prevind (s, j)) .+ s. offset
7576 update_arg (ex);
Original file line number Diff line number Diff line change 830830@testset " fieldtypes Module" begin
831831 @test fieldtypes (Module) isa Tuple
832832end
833+
834+
835+ @testset " issue #28188" begin
836+ @test ` $(@__FILE__ ) ` == let file = @__FILE__ ; ` $file ` end
837+ end
You can’t perform that action at this time.
0 commit comments