Skip to content

Commit

Permalink
improve error message for unsafe flags (#385)
Browse files Browse the repository at this point in the history
* improve error message for unsafe flags

This makes it clearer, that Binary builder actually doesn't allow unsafe flags and errors.

* Update src/Runner.jl

Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com>

* Update runners.jl

---------

Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com>
  • Loading branch information
SimonDanisch and giordano authored Aug 3, 2024
1 parent bfac3a4 commit 56580d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
if length(unsafe_flags) >= 1
write(io, """
if [[ "\${ARGS[@]}" =~ \"$(join(unsafe_flags, "\"|\""))\" ]]; then
echo -e \"BinaryBuilder: You used one or more of the unsafe flags: $(join(unsafe_flags, ", "))\\nPlease repent.\" >&2
echo -e \"BinaryBuilder error: You used one or more of the unsafe flags: $(join(unsafe_flags, ", "))\\nThis is not allowed, please remove all unsafe flags from your build script to continue.\" >&2
exit 1
fi
""")
Expand Down
4 changes: 2 additions & 2 deletions test/runners.jl
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ end
@test !run(ur, cmd, iobuff; tee_stream=devnull)
seekstart(iobuff)
lines = readlines(iobuff)
@test lines[2] == "BinaryBuilder: You used one or more of the unsafe flags: -Ofast, -ffast-math, -funsafe-math-optimizations"
@test lines[3] == "Please repent."
@test lines[2] == "BinaryBuilder error: You used one or more of the unsafe flags: -Ofast, -ffast-math, -funsafe-math-optimizations"
@test lines[3] == "This is not allowed, please remove all unsafe flags from your build script to continue."

ur = preferred_runner()(dir; platform=platform, allow_unsafe_flags=true)
iobuff = IOBuffer()
Expand Down

0 comments on commit 56580d9

Please sign in to comment.