Skip to content

Commit 7b9f532

Browse files
authored
fix #59252, make args in juliac like it is elsewhere (#59279)
Also set PROGRAM_FILE and ARGS. fixes #59252
1 parent abb7a76 commit 7b9f532

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

contrib/juliac/juliac-buildscript.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ import Base.Experimental.entrypoint
3434
# for use as C main if needed
3535
function _main(argc::Cint, argv::Ptr{Ptr{Cchar}})::Cint
3636
args = ccall(:jl_set_ARGS, Any, (Cint, Ptr{Ptr{Cchar}}), argc, argv)::Vector{String}
37+
setglobal!(Base, :PROGRAM_FILE, args[1])
38+
popfirst!(args)
39+
append!(Base.ARGS, args)
3740
return Main.main(args)
3841
end
3942

test/trimming/hello.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ sum_areas(v::Vector{Shape}) = sum(area, v)
1717

1818
function @main(args::Vector{String})::Cint
1919
println(Core.stdout, str())
20+
println(Core.stdout, PROGRAM_FILE)
2021
foreach(x->println(Core.stdout, x), args)
2122

2223
# test map/mapreduce; should work but relies on inlining and other optimizations

0 commit comments

Comments
 (0)