Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/imageproxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,9 @@ impl TryFrom<ImageProxyConfig> for Command {
let mut c = std::process::Command::new("skopeo");
unsafe {
c.pre_exec(|| {
rustix::process::set_parent_process_death_signal(Some(
Ok(rustix::process::set_parent_process_death_signal(Some(
rustix::process::Signal::TERM,
))
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))
))?)
Comment on lines +282 to +284

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While the Ok(...?) pattern works correctly here because the success type is (), it can be a bit subtle. A more direct and idiomatic approach is to use map_err to handle the error conversion explicitly. This makes the intent of the code clearer to future readers.

                    rustix::process::set_parent_process_death_signal(Some(
                        rustix::process::Signal::TERM,
                    ))
                    .map_err(Into::into)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider: nuh-uh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda agree with this comment. That ? is carrying an awful lot of weight here, and it's not clear to me what implementation we're going to end up using or if it's going to allocate. A more explicit constructor (more explicit even than what the bot recommended) and comment that we're trying to avoid allocations would also be nice....

});
}
c
Expand Down