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

Query OUT_DIR at runtime. #770

Merged
merged 1 commit into from
Dec 8, 2016
Merged

Conversation

BurntSushi
Copy link
Contributor

It seems that Cargo no longer sets OUT_DIR when compiling build.rs, but
it's still available at runtime. Therefore, switch env! to
env::var_os.

It seems that Cargo no longer sets OUT_DIR when compiling build.rs, but
it's still available at runtime. Therefore, switch `env!` to
`env::var_os`.
@BurntSushi
Copy link
Contributor Author

I looked around briefly in Cargo's history to see where this change actually happened, but couldn't find it.

We could use env::var_os("...").unwrap() to make this example more terse, but I sometimes try to avoid unwrap in examples. I don't have a strong opinion though!

@coveralls
Copy link

coveralls commented Dec 7, 2016

Coverage Status

Coverage remained the same at 91.085% when pulling c94a8f5 on BurntSushi:fix-out-dir-example into b225cdb on kbknapp:master.

@nabijaczleweli
Copy link
Contributor

This is the correcter way of doing build.rs, yes

@kbknapp
Copy link
Member

kbknapp commented Dec 7, 2016

Great catch, I wasn't aware of this change! Thanks!

@homu r+

@homu
Copy link
Contributor

homu commented Dec 7, 2016

📌 Commit c94a8f5 has been approved by kbknapp

homu added a commit that referenced this pull request Dec 7, 2016
Query OUT_DIR at runtime.

It seems that Cargo no longer sets OUT_DIR when compiling build.rs, but
it's still available at runtime. Therefore, switch `env!` to
`env::var_os`.
@homu
Copy link
Contributor

homu commented Dec 7, 2016

⌛ Testing commit c94a8f5 with merge f3f552b...

homu added a commit that referenced this pull request Dec 7, 2016
Query OUT_DIR at runtime.

It seems that Cargo no longer sets OUT_DIR when compiling build.rs, but
it's still available at runtime. Therefore, switch `env!` to
`env::var_os`.
@homu
Copy link
Contributor

homu commented Dec 7, 2016

☀️ Test successful - status

@homu
Copy link
Contributor

homu commented Dec 7, 2016

👀 Test was successful, but fast-forwarding failed: 422 Required status check "coverage/coveralls" is pending.

@kbknapp kbknapp merged commit 4aec1a5 into clap-rs:master Dec 8, 2016
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.

5 participants