Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve error message for unsafe flags #385

Merged
merged 3 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading