Skip to content

Commit

Permalink
Fix Runic.main on old Julia versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed May 27, 2024
1 parent 0d4c318 commit dfdd703
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/Runic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,6 @@ function format_file(inputfile::AbstractString, outputfile::AbstractString = inp
end

include("runestone.jl")

if isdefined(Base, Symbol("@main"))
include("main.jl")
end
include("main.jl")

end # module
12 changes: 10 additions & 2 deletions src/main.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: MIT

errno::Cint = 0
@static if VERSION >= v"1.8"
errno::Cint = 0
else
errno = 0
end

function panic(msg...)
printstyled(stderr, "ERROR: "; color = :red, bold = true)
Expand All @@ -16,7 +20,7 @@ function panic(msg...)
return errno
end

function (@main)(argv)
function main(argv)
# Reset errno
global errno = 0

Expand Down Expand Up @@ -146,3 +150,7 @@ function (@main)(argv)

return errno
end

@static if isdefined(Base, Symbol("@main"))
@main
end

0 comments on commit dfdd703

Please sign in to comment.