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

Expose cargo failures #15

Merged
merged 3 commits into from Feb 13, 2016

Conversation

Projects
None yet
2 participants
@White-Oak
Contributor

White-Oak commented Feb 11, 2016

cargo::call properly returns Some() (I still think it should be Result instead of Option) if cargo task has failed (exited with non-zero status).

tests.sh
+
+ if [ $? -ne 0 ]; then
+ echo "--- Passed!"
+ echo

This comment has been minimized.

@ebkalderon

ebkalderon Feb 12, 2016

Member

There is something of a spacing issue here on line 83. Not very important, but my OCD just kicked in. 😉

@ebkalderon

ebkalderon Feb 12, 2016

Member

There is something of a spacing issue here on line 83. Not very important, but my OCD just kicked in. 😉

src/cli/cargo.rs
+ Some("Cargo task failed!")
+ }
+ }
+ Err(_) => Some("Failed to run Cargo!"),
}

This comment has been minimized.

@ebkalderon

ebkalderon Feb 12, 2016

Member

I am considering using an if let statement in this case, since we are only using the contents of Ok but not Err. Tell me what you think of this:

let exec_result = command.stdout(Stdio::inherit())
                         .stderr(Stdio::inherit())
                         .output();

if let Ok(output) = exec_result {
    if output.status.success() {
        None
    } else {
        Some("Cargo exited with an error!")
    }
} else {
    Some("Could not launch Cargo!")
}
@ebkalderon

ebkalderon Feb 12, 2016

Member

I am considering using an if let statement in this case, since we are only using the contents of Ok but not Err. Tell me what you think of this:

let exec_result = command.stdout(Stdio::inherit())
                         .stderr(Stdio::inherit())
                         .output();

if let Ok(output) = exec_result {
    if output.status.success() {
        None
    } else {
        Some("Cargo exited with an error!")
    }
} else {
    Some("Could not launch Cargo!")
}
@ebkalderon

This comment has been minimized.

Show comment
Hide comment
@ebkalderon

ebkalderon Feb 12, 2016

Member

@White-Oak Besides the two comments above, this looks pretty good. I'm going to build this on my local machine to try it out. Just fix the spacing on that one line, and it will be merge-ready.

Member

ebkalderon commented Feb 12, 2016

@White-Oak Besides the two comments above, this looks pretty good. I'm going to build this on my local machine to try it out. Just fix the spacing on that one line, and it will be merge-ready.

Improved matching on result of cargo running
Attempted to fix spacing in changed code in tests.sh.

ebkalderon added a commit that referenced this pull request Feb 13, 2016

@ebkalderon ebkalderon merged commit b0a3a86 into amethyst:master Feb 13, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ebkalderon

This comment has been minimized.

Show comment
Hide comment
@ebkalderon

ebkalderon Feb 13, 2016

Member

Thanks for the changes, @White-Oak! This and pull request #14 together bring us almost ready to closing issue #13. Merged.

Member

ebkalderon commented Feb 13, 2016

Thanks for the changes, @White-Oak! This and pull request #14 together bring us almost ready to closing issue #13. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment