Skip to content

Commit 395669b

Browse files
committed
skipping uname call for windows too
1 parent 568a69f commit 395669b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/packages/uname.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11

2-
#[cfg(not(target_arch = "wasm32"))]
3-
pub fn uname() -> std::io::Result<String> {
4-
let x = uname::uname()?;
5-
Ok(format!(
6-
"{sysname} {version} {release} {machine} {nodename}",
7-
sysname = x.sysname,
8-
version = x.version,
9-
release = x.release,
10-
machine = x.machine,
11-
nodename = x.nodename
12-
))
2+
cfg_if::cfg_if! {
3+
if #[cfg(all(target_arch = "wasm32", target_os = "windows"))] {
4+
pub fn uname() -> std::io::Result<String> {
5+
Err(std::io::Error::new(std::io::ErrorKind::NotFound, "not supported on wasm32"))
6+
}
7+
} else {
8+
pub fn uname() -> std::io::Result<String> {
9+
let x = uname::uname()?;
10+
Ok(format!(
11+
"{sysname} {version} {release} {machine} {nodename}",
12+
sysname = x.sysname,
13+
version = x.version,
14+
release = x.release,
15+
machine = x.machine,
16+
nodename = x.nodename
17+
))
18+
}
19+
}
1320
}
14-
15-
#[cfg(target_arch = "wasm32")]
16-
pub fn uname() -> std::io::Result<String> {
17-
Err(std::io::Error::new(std::io::ErrorKind::NotFound, "not supported on wasm32"))
18-
}

0 commit comments

Comments
 (0)