rustyhorde / vergen

Generate cargo instructions at compile time in build scripts for use with the env! or option_env! macros
Apache License 2.0
389 stars 57 forks source link

Build script with vergen collecting system info might take a lot of time #266

Closed akoptelov closed 9 months ago

akoptelov commented 11 months ago

With current usage in vergen crate, sysinfo accesses all filesystems on the host. If there is a network filesystem that cannot be mounted (e.g. it is in a different network), sysinfo's System::new_all() might be stuck for some time.

In my case, this is automount entries with content from my NAS server that causing the issue.

How to reproduce (currently inaccessible network filesystem should exist): Within a rust project (e.g. created with cargo new vergen-sysinfo-test), create a build.rs with the following content:

fn main() -> Result<(), Box<dyn std::error::Error>> {
    vergen::EmitBuilder::builder().all_sysinfo().emit_and_set()?;
    Ok(())
}

and run

cargo build --verbose