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

Surface any cargo metadata errors #286

Merged
merged 2 commits into from May 27, 2021
Merged

Conversation

fgsch
Copy link
Member

@fgsch fgsch commented May 21, 2021

While here also fix a logic bug.

@fgsch
Copy link
Member Author

fgsch commented May 21, 2021

Sample out before and after:

Before:

ERROR: error reading cargo metadata: EOF.

After:

ERROR: error reading cargo metadata: error: failed to parse manifest at `/some/path/Cargo.toml`

Caused by:
  could not parse input as TOML

Caused by:
  expected an equals, found an identifier at line 11 column 3.

fgsch added 2 commits May 21, 2021 12:08
We were showing the verbose output when verbose was NOT set.
@fgsch fgsch force-pushed the fgsch/cargo-metadata-error branch from 2fa9e81 to afe21d6 Compare May 21, 2021 11:09
@Integralist Integralist added the enhancement New feature or request label May 24, 2021
@@ -64,17 +64,15 @@ type CargoMetadata struct {
// Read the contents of the Cargo.lock file from filename.
func (m *CargoMetadata) Read() error {
cmd := exec.Command("cargo", "metadata", "--quiet", "--format-version", "1")
stdout, err := cmd.StdoutPipe()
stdoutStderr, err := cmd.CombinedOutput()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phamann do you have any historical context around the use of .StdoutPipe()?

Copy link
Collaborator

@Integralist Integralist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to approve as there's been no further feedback re: historical reason for using StdoutPipe. I checked the original PR that introduced the change and that doesn't indicate any specific reasoning for using that over CombinedOutput.

@Integralist Integralist merged commit becf1a0 into main May 27, 2021
@Integralist Integralist deleted the fgsch/cargo-metadata-error branch May 27, 2021 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants