diff options
Diffstat (limited to 'crates/stdx/src/lib.rs')
-rw-r--r-- | crates/stdx/src/lib.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index 18d5fadb9..2963484fa 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs | |||
@@ -110,7 +110,7 @@ pub fn defer<F: FnOnce()>(f: F) -> impl Drop { | |||
110 | D(Some(f)) | 110 | D(Some(f)) |
111 | } | 111 | } |
112 | 112 | ||
113 | #[repr(transparent)] | 113 | #[cfg_attr(not(target_arch = "wasm32"), repr(transparent))] |
114 | pub struct JodChild(pub std::process::Child); | 114 | pub struct JodChild(pub std::process::Child); |
115 | 115 | ||
116 | impl ops::Deref for JodChild { | 116 | impl ops::Deref for JodChild { |
@@ -135,7 +135,10 @@ impl Drop for JodChild { | |||
135 | 135 | ||
136 | impl JodChild { | 136 | impl JodChild { |
137 | pub fn into_inner(self) -> std::process::Child { | 137 | pub fn into_inner(self) -> std::process::Child { |
138 | // SAFETY: repr transparent | 138 | if cfg!(target_arch = "wasm32") { |
139 | panic!("no processes on wasm"); | ||
140 | } | ||
141 | // SAFETY: repr transparent, except on WASM | ||
139 | unsafe { std::mem::transmute::<JodChild, std::process::Child>(self) } | 142 | unsafe { std::mem::transmute::<JodChild, std::process::Child>(self) } |
140 | } | 143 | } |
141 | } | 144 | } |