Browse Source

Fix Runic.main on old Julia versions.

pull/19/head
Fredrik Ekre 2 years ago
parent
commit
dfdd7033f7
No known key found for this signature in database
GPG Key ID: DE82E6D5E364C0A2
  1. 3
      src/Runic.jl
  2. 10
      src/main.jl

3
src/Runic.jl

@ -461,9 +461,6 @@ function format_file(inputfile::AbstractString, outputfile::AbstractString = inp
end end
include("runestone.jl") include("runestone.jl")
if isdefined(Base, Symbol("@main"))
include("main.jl") include("main.jl")
end
end # module end # module

10
src/main.jl

@ -1,6 +1,10 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
@static if VERSION >= v"1.8"
errno::Cint = 0 errno::Cint = 0
else
errno = 0
end
function panic(msg...) function panic(msg...)
printstyled(stderr, "ERROR: "; color = :red, bold = true) printstyled(stderr, "ERROR: "; color = :red, bold = true)
@ -16,7 +20,7 @@ function panic(msg...)
return errno return errno
end end
function (@main)(argv) function main(argv)
# Reset errno # Reset errno
global errno = 0 global errno = 0
@ -146,3 +150,7 @@ function (@main)(argv)
return errno return errno
end end
@static if isdefined(Base, Symbol("@main"))
@main
end

Loading…
Cancel
Save