Skip to content

Commit 9b3dadf

Browse files
Copilotedburns
andauthored
fix: skip CLI download in build.rs when DOCS_RS env var is set (#1660)
* Initial plan * fix: skip CLI download in build.rs when DOCS_RS env var is set docs.rs builds in a sandboxed environment without network access. The build.rs script was failing because it tried to download the Copilot CLI binary. Detect the DOCS_RS environment variable (set automatically by docs.rs) and skip the download, similar to the existing COPILOT_SKIP_CLI_DOWNLOAD escape hatch. Co-authored-by: edburns <75821+edburns@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: edburns <75821+edburns@users.noreply.github.com> Co-authored-by: Ed Burns <edburns@microsoft.com>
1 parent ff49ed2 commit 9b3dadf

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

rust/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::time::Duration;
55
use sha2::Digest;
66

77
fn main() {
8+
println!("cargo:rerun-if-env-changed=DOCS_RS");
89
println!("cargo:rerun-if-env-changed=COPILOT_SKIP_CLI_DOWNLOAD");
910
println!("cargo:rerun-if-env-changed=COPILOT_CLI_EXTRACT_DIR");
1011
println!("cargo:rerun-if-env-changed=BUNDLED_CLI_CACHE_DIR");
@@ -43,6 +44,13 @@ fn main() {
4344
return;
4445
}
4546

47+
// docs.rs builds in a sandboxed environment without network access.
48+
// Skip the CLI download so documentation can be generated successfully.
49+
if std::env::var_os("DOCS_RS").is_some() {
50+
println!("cargo:warning=DOCS_RS is set — skipping CLI download/bundle/cache");
51+
return;
52+
}
53+
4654
let Some(platform) = target_platform() else {
4755
println!("cargo:warning=Unsupported target platform for Copilot CLI bundling — skipping");
4856
return;

0 commit comments

Comments
 (0)