(zilch lang rust cargo): parse cfg values at runtime

This commit is contained in:
puck 2024-11-27 14:18:18 +00:00
parent 9f23179d46
commit 054b320f27
3 changed files with 34 additions and 37 deletions

10
lang/rust/cfg-fetch.rs Normal file
View file

@ -0,0 +1,10 @@
use std::{env::var_os, fs::{create_dir, File}, os::unix::process::CommandExt, process::Command};
fn main() {
Err(
Command::new(var_os("rustc").unwrap())
.arg("--print=cfg")
.stdout(File::create(var_os("out").unwrap()).unwrap())
.exec())
.unwrap()
}