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

seahorse build displays an error despite successful compilation #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maxims94
Copy link

Problem

When you create a new Seahorse project and build it for the first time, it will show that compilation has failed (This is most likely a bug in the Seahorse compiler! [...])

If you run it again, the error message is no longer displayed and it says the project was successfully compiled.

Since target/deploy/program.so exists, it was actually successfully compiled.

Cause

In src/bin/cli/build.rs, there is a check to determine whether to show the message:

if !anchor_output.status.success()  || stderr.contains("error") | stderr.contains("panicked")

The assumption was probably that Anchor only sends warnings and errors to stderr. Unfortunately, this is not the case. Everything is sent to stderr, including Compiling statements.

This means that outputs like Compiling thiserror v1.0.51 are matched, which causes the error message to be displayed.

Solution

Create a filtered version of stderr where all Compiling statements are removed and perform the check on that.

Alternative

The cleanest solution would be to use if !anchor_output.status.success() as the only check -- but I'm not sure how reliable the exit code of anchor build is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant