From f2aecb814a4066db26c24453c55576f24531a088 Mon Sep 17 00:00:00 2001 From: Steven Engler Date: Sun, 23 Jun 2024 00:34:39 -0400 Subject: [PATCH] Removed fallback for `user_edit` The `memfd_create` syscall has been around since Linux 3.17, so no need to have a fallback path for this. --- src/ui.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/ui.rs b/src/ui.rs index 0f8cb3b..b89c1c3 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -22,15 +22,7 @@ fn user_edit( ) -> std::io::Result>> { #[cfg(target_os = "linux")] { - let mut rv = user_edit_linux(text, editor_cmd.clone()); - - // if the linux-specific version failed with ENOTSUP, then try again with a - // more-compatible version - if rv.as_ref().err().map(|e| e.kind()) == Some(std::io::ErrorKind::Unsupported) { - rv = user_edit_compat(text, editor_cmd); - } - - rv + user_edit_linux(text, editor_cmd) } #[cfg(not(target_os = "linux"))] @@ -93,6 +85,7 @@ fn user_edit_linux( } /// A platform-agnostic variant of [`user_edit`]. +#[cfg(any(test, not(target_os = "linux")))] fn user_edit_compat( text: &[u8], editor_cmd: impl IntoIterator>,