Correct some comments and duplicative error messages

If we fail to create a pipe, we will report that fact in multiple places; remove
some redundant error reporting.
This commit is contained in:
ridiculousfish 2024-02-11 12:16:58 -08:00
parent b9ba9e57e8
commit 5021639db1
4 changed files with 3 additions and 5 deletions

View file

@ -138,7 +138,6 @@ pub fn exec_job(parser: &Parser, job: &Job, block_io: IoChain) -> bool {
if !p.is_last_in_job { if !p.is_last_in_job {
let Ok(pipes) = make_autoclose_pipes() else { let Ok(pipes) = make_autoclose_pipes() else {
FLOGF!(warning, "%ls", wgettext!(PIPE_ERROR)); FLOGF!(warning, "%ls", wgettext!(PIPE_ERROR));
perror("pipe");
aborted_pipeline = true; aborted_pipeline = true;
abort_pipeline_from(job, i); abort_pipeline_from(job, i);
break; break;

View file

@ -63,7 +63,6 @@ impl FdEventSignaller {
{ {
// Implementation using pipes. // Implementation using pipes.
let Ok(pipes) = make_autoclose_pipes() else { let Ok(pipes) = make_autoclose_pipes() else {
perror("pipe");
exit_without_destructors(1); exit_without_destructors(1);
}; };
make_fd_nonblocking(pipes.read.as_raw_fd()).unwrap(); make_fd_nonblocking(pipes.read.as_raw_fd()).unwrap();

View file

@ -149,7 +149,7 @@ pub fn make_autoclose_pipes() -> nix::Result<AutoClosePipes> {
Ok(pipes) => pipes, Ok(pipes) => pipes,
Err(err) => { Err(err) => {
FLOG!(warning, PIPE_ERROR); FLOG!(warning, PIPE_ERROR);
perror("pipe2"); perror("pipe");
return Err(err); return Err(err);
} }
}; };

View file

@ -345,12 +345,12 @@ pub struct IoBufferfill {
} }
impl IoBufferfill { impl IoBufferfill {
/// Create an io_bufferfill_t which, when written from, fills a buffer with the contents. /// Create an io_bufferfill_t which, when written from, fills a buffer with the contents.
/// \returns nullptr on failure, e.g. too many open fds. /// \returns an error on failure, e.g. too many open fds.
pub fn create() -> io::Result<Arc<IoBufferfill>> { pub fn create() -> io::Result<Arc<IoBufferfill>> {
Self::create_opts(0, STDOUT_FILENO) Self::create_opts(0, STDOUT_FILENO)
} }
/// Create an io_bufferfill_t which, when written from, fills a buffer with the contents. /// Create an io_bufferfill_t which, when written from, fills a buffer with the contents.
/// \returns nullptr on failure, e.g. too many open fds. /// \returns an error on failure, e.g. too many open fds.
/// ///
/// \param target the fd which this will be dup2'd to - typically stdout. /// \param target the fd which this will be dup2'd to - typically stdout.
pub fn create_opts(buffer_limit: usize, target: RawFd) -> io::Result<Arc<IoBufferfill>> { pub fn create_opts(buffer_limit: usize, target: RawFd) -> io::Result<Arc<IoBufferfill>> {