Skip to content

Commit

Permalink
Use Infallible in the exec_monitor return type
Browse files Browse the repository at this point in the history
This makes it clearer that exec_monitor can only return when there is an
error.
  • Loading branch information
bjorn3 committed Oct 22, 2024
1 parent 686a878 commit 644e1d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/exec/use_pty/monitor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{ffi::c_int, io, os::unix::process::CommandExt, process::Command};
use std::{convert::Infallible, ffi::c_int, io, os::unix::process::CommandExt, process::Command};

use crate::exec::{opt_fmt, signal_fmt};
use crate::system::signal::{
Expand All @@ -17,7 +17,6 @@ use crate::{
exec::{
event::{PollEvent, StopReason},
use_pty::{SIGCONT_BG, SIGCONT_FG},
ExecOutput,
},
log::{dev_error, dev_info, dev_warn},
system::FileCloser,
Expand All @@ -36,15 +35,14 @@ use crate::{

use super::CommandStatus;

// FIXME: This should return `io::Result<!>` but `!` is not stable yet.
pub(super) fn exec_monitor(
pty_follower: PtyFollower,
command: Command,
foreground: bool,
backchannel: &mut MonitorBackchannel,
mut file_closer: FileCloser,
original_set: Option<SignalSet>,
) -> io::Result<ExecOutput> {
) -> io::Result<Infallible> {
// SIGTTIN and SIGTTOU are ignored here but the docs state that it shouldn't
// be possible to receive them in the first place. Investigate
match SignalHandler::register(SIGTTIN, SignalHandlerBehavior::Ignore) {
Expand Down
2 changes: 1 addition & 1 deletion src/exec/use_pty/parent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub(in crate::exec) fn exec_pty(
file_closer,
original_set,
) {
Ok(exec_output) => return Ok(exec_output),
Ok(exec_output) => match exec_output {},
Err(err) => {
// Disable nonblocking assetions as we will not poll the backchannel anymore.
backchannels.monitor.set_nonblocking_assertions(true);
Expand Down

0 comments on commit 644e1d3

Please sign in to comment.