summaryrefslogtreecommitdiff
path: root/ext/node
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node')
-rw-r--r--ext/node/build.rs7
-rw-r--r--ext/node/lib.rs7
2 files changed, 8 insertions, 6 deletions
diff --git a/ext/node/build.rs b/ext/node/build.rs
new file mode 100644
index 000000000..778f2da17
--- /dev/null
+++ b/ext/node/build.rs
@@ -0,0 +1,7 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
+use std::env;
+
+fn main() {
+ println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());
+}
diff --git a/ext/node/lib.rs b/ext/node/lib.rs
index 40330dc5b..e2643a84f 100644
--- a/ext/node/lib.rs
+++ b/ext/node/lib.rs
@@ -132,12 +132,7 @@ pub static NODE_ENV_VAR_ALLOWLIST: Lazy<HashSet<String>> = Lazy::new(|| {
#[op]
fn op_node_build_os() -> String {
- std::env::var("TARGET")
- .unwrap()
- .split('-')
- .nth(2)
- .unwrap()
- .to_string()
+ env!("TARGET").split('-').nth(2).unwrap().to_string()
}
#[op(fast)]