This repository was archived by the owner on Dec 29, 2021. It is now read-only.
WIP: Make cargo bin helpers work with empty env#54
Open
Conversation
`clap` couldn't be used for command line arguments. I didn't want to add it as a dependency for clients, which meant it had to be optional. The problem is that `main_binary` and `cargo_binary` run with optional features enabled. Note: you cannot use `main_binary` or `cargo_binary` - With `Environment::empty` because the executable can't be found - In skeptic tests (like the README) because the working dir is changed
We use cargo run behind the scenes to run the main binary but that should only be an implementation detail. Fixes #45
killercup
commented
Oct 13, 2017
Collaborator
Author
killercup
left a comment
There was a problem hiding this comment.
This is just a first draft.
cc @Freyskeyd: This solves #51 without the need for Freyskeyd/environment#4
| use std::process::{Command, Stdio}; | ||
| use std::vec::Vec; | ||
|
|
||
| fn find_cargo() -> String { |
Collaborator
Author
There was a problem hiding this comment.
We should should need to panic in this fn at all
| /// | ||
| /// Defaults to asserting _successful_ execution. | ||
| fn default() -> Self { | ||
| let cargo_path = find_cargo(); |
Collaborator
Author
There was a problem hiding this comment.
This fn can currently panic. We should deal with the result instead and maybe cache the error in the Assert struct so we can return it only when running execute or unwrap
Collaborator
There was a problem hiding this comment.
The main value of caching the result would be for when calling .execute() rather than .unwrap(), right?
Also, should the result of find_cargo be shoved off into a lazy_static!?
epage
reviewed
Oct 13, 2017
| use std::vec::Vec; | ||
|
|
||
| fn find_cargo() -> String { | ||
| let which_cargo = Command::new("which").arg("cargo") |
Collaborator
There was a problem hiding this comment.
At this point, we should probably add a Windows CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently based on #50 and very much WIP.