Skip to content

Commit f41f678

Browse files
JeffBezansonKristofferC
authored andcommitted
fix #59252, make args in juliac like it is elsewhere (#59279)
Also set PROGRAM_FILE and ARGS. fixes #59252 (cherry picked from commit 7b9f532)
1 parent 7cd4fff commit f41f678

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
@@ -5,6 +5,7 @@ end
55

66
function @main(args::Vector{String})::Cint
77
println(Core.stdout, str())
8+
println(Core.stdout, PROGRAM_FILE)
89
foreach(x->println(Core.stdout, x), args)
910
return 0
1011
end

0 commit comments

Comments
 (0)