Skip to content

Commit

Permalink
Removed fallback for user_edit
Browse files Browse the repository at this point in the history
The `memfd_create` syscall has been around since Linux 3.17, so no need
to have a fallback path for this.
  • Loading branch information
stevenengler committed Jun 23, 2024
1 parent c95d2dc commit f2aecb8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ fn user_edit(
) -> std::io::Result<Option<Vec<u8>>> {
#[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"))]
Expand Down Expand Up @@ -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<Item = impl AsRef<OsStr>>,
Expand Down

0 comments on commit f2aecb8

Please sign in to comment.