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

There should be a to not rely on CARGO_MANIFEST_DIR to exist at runtime. #180

Closed
Fuuzetsu opened this issue May 4, 2021 · 1 comment
Closed

Comments

@Fuuzetsu
Copy link

Fuuzetsu commented May 4, 2021

For various reasons, we do our builds it a temporary location. This means that anything that uses assert_snapshot gets the temporary location embedded into the binary via the env!("CARGO_MANIFEST_DIR"). Once we go onto trying to run the test binary produced during the build, it fails.

Having said that, we run the test binaries with sources (and so also with snapshots) available: therefore insta should be able to find the files but it insists on using manifest_dir for all its queries which is a location that doesn't exist.

It would be extremely useful to be able to tell insta at runtime of where it should try to find out the workspace metadata. For us this would just be pwd.

@Fuuzetsu
Copy link
Author

Fuuzetsu commented May 4, 2021

A simple way would be to add something like:

let manifest_dir = std::env::var("INSTA_MANIFEST_DIR").unwrap_or(manifest_dir);

This would allow whatever system to set the variable at runtime and everyone is happy.

Fuuzetsu added a commit to Fuuzetsu/insta that referenced this issue May 5, 2021

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
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 a pull request may close this issue.

1 participant