builtins: idiomatic error code passing

Remaining code smells:
- exec_subshell_internal needs to convert a number to a result

Closes #10948
This commit is contained in:
Sander Machado
2024-12-30 00:00:46 +01:00
committed by Johannes Altmanninger
parent bdb8f7da3a
commit f4a8368c9e
68 changed files with 1080 additions and 1098 deletions

View File

@@ -668,7 +668,7 @@ pub fn flush_and_check_error(&mut self) -> libc::c_int {
match self {
OutputStream::Fd(stream) => stream.flush_and_check_error(),
OutputStream::Buffered(stream) => stream.flush_and_check_error(),
OutputStream::Null | OutputStream::String(_) => STATUS_CMD_OK.unwrap(),
OutputStream::Null | OutputStream::String(_) => STATUS_CMD_OK,
}
}
@@ -794,7 +794,6 @@ fn flush_and_check_error(&mut self) -> libc::c_int {
} else {
STATUS_CMD_OK
}
.unwrap()
}
}
@@ -839,7 +838,7 @@ fn append_with_separation(
}
fn flush_and_check_error(&mut self) -> libc::c_int {
if self.buffer.discarded() {
return STATUS_READ_TOO_MUCH.unwrap();
return STATUS_READ_TOO_MUCH;
}
0
}