1 #[cfg(any(unix, feature = "dox"))] 2 use gio_sys; 3 #[cfg(any(unix, feature = "dox"))] 4 use glib::translate::*; 5 #[cfg(any(unix, all(feature = "dox", unix)))] 6 use std::os::unix::io::IntoRawFd; 7 use SubprocessLauncher; 8 9 #[cfg(all(feature = "dox", not(unix)))] 10 pub trait IntoRawFd: Sized { into_raw_fd(self) -> i3211 fn into_raw_fd(self) -> i32 { 12 0 13 } 14 } 15 16 impl SubprocessLauncher { 17 #[cfg(any(unix, feature = "dox"))] take_fd<F: IntoRawFd, G: IntoRawFd>(&self, source_fd: F, target_fd: G)18 pub fn take_fd<F: IntoRawFd, G: IntoRawFd>(&self, source_fd: F, target_fd: G) { 19 unsafe { 20 gio_sys::g_subprocess_launcher_take_fd( 21 self.to_glib_none().0, 22 source_fd.into_raw_fd(), 23 target_fd.into_raw_fd(), 24 ); 25 } 26 } 27 28 #[cfg(any(unix, feature = "dox"))] take_stderr_fd<F: IntoRawFd>(&self, fd: F)29 pub fn take_stderr_fd<F: IntoRawFd>(&self, fd: F) { 30 unsafe { 31 gio_sys::g_subprocess_launcher_take_stderr_fd(self.to_glib_none().0, fd.into_raw_fd()); 32 } 33 } 34 35 #[cfg(any(unix, feature = "dox"))] take_stdin_fd<F: IntoRawFd>(&self, fd: F)36 pub fn take_stdin_fd<F: IntoRawFd>(&self, fd: F) { 37 unsafe { 38 gio_sys::g_subprocess_launcher_take_stdin_fd(self.to_glib_none().0, fd.into_raw_fd()); 39 } 40 } 41 42 #[cfg(any(unix, feature = "dox"))] take_stdout_fd<F: IntoRawFd>(&self, fd: F)43 pub fn take_stdout_fd<F: IntoRawFd>(&self, fd: F) { 44 unsafe { 45 gio_sys::g_subprocess_launcher_take_stdout_fd(self.to_glib_none().0, fd.into_raw_fd()); 46 } 47 } 48 } 49