@@ -8,6 +8,7 @@ use crate::fmt;
88use crate :: fs;
99use crate :: marker:: PhantomData ;
1010use crate :: mem:: forget;
11+ #[ cfg( not( target_os = "wasi" ) ) ]
1112use crate :: sys:: cvt;
1213use crate :: sys_common:: { AsInner , FromInner , IntoInner } ;
1314
@@ -71,6 +72,7 @@ impl BorrowedFd<'_> {
7172impl OwnedFd {
7273 /// Creates a new `OwnedFd` instance that shares the same underlying file handle
7374 /// as the existing `OwnedFd` instance.
75+ #[ cfg( not( target_os = "wasi" ) ) ]
7476 pub fn try_clone ( & self ) -> crate :: io:: Result < Self > {
7577 // We want to atomically duplicate this file descriptor and set the
7678 // CLOEXEC flag, and currently that's done via F_DUPFD_CLOEXEC. This
@@ -88,6 +90,14 @@ impl OwnedFd {
8890 let fd = cvt ( unsafe { libc:: fcntl ( self . as_raw_fd ( ) , cmd, 0 ) } ) ?;
8991 Ok ( unsafe { Self :: from_raw_fd ( fd) } )
9092 }
93+
94+ #[ cfg( target_os = "wasi" ) ]
95+ pub fn try_clone ( & self ) -> crate :: io:: Result < Self > {
96+ Err ( crate :: io:: Error :: new_const (
97+ crate :: io:: ErrorKind :: Unsupported ,
98+ & "operation not supported on WASI yet" ,
99+ ) )
100+ }
91101}
92102
93103#[ unstable( feature = "io_safety" , issue = "87074" ) ]
0 commit comments