1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 04:56:12 +03:00

fix warning

This commit is contained in:
Wez Furlong 2024-11-19 10:14:32 -07:00
parent 979df78269
commit 4050072da2
No known key found for this signature in database
GPG Key ID: A7E93559F0040A51

View File

@ -320,7 +320,11 @@ impl FileDescriptor {
};
let std_original = FileDescriptor::dup(&std_descriptor)?;
unsafe { FileDescriptor::dup2(f, std_descriptor) }?.into_raw_fd();
// Assign f into std_descriptor, then convert to an fd so that
// we don't close it when the returned FileDescriptor is dropped.
// Then we discard/ignore the fd because it is nominally owned by
// the stdio machinery for the process
let _ = unsafe { FileDescriptor::dup2(f, std_descriptor) }?.into_raw_fd();
Self::no_cloexec(std_descriptor)?;
Ok(std_original)