mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 01:51:14 -03:00
committed by
Johannes Altmanninger
parent
5d37698ef8
commit
17ba602acf
28
src/io.rs
28
src/io.rs
@@ -162,11 +162,11 @@ fn try_add_size(&mut self, delta: usize) -> bool {
|
||||
/// Describes what type of IO operation an io_data_t represents.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum IoMode {
|
||||
file,
|
||||
pipe,
|
||||
fd,
|
||||
close,
|
||||
bufferfill,
|
||||
File,
|
||||
Pipe,
|
||||
Fd,
|
||||
Close,
|
||||
BufferFill,
|
||||
}
|
||||
|
||||
/// Represents a FD redirection.
|
||||
@@ -196,7 +196,7 @@ pub fn new(fd: RawFd) -> Self {
|
||||
}
|
||||
impl IoData for IoClose {
|
||||
fn io_mode(&self) -> IoMode {
|
||||
IoMode::close
|
||||
IoMode::Close
|
||||
}
|
||||
fn fd(&self) -> RawFd {
|
||||
self.fd
|
||||
@@ -222,7 +222,7 @@ pub fn new(fd: RawFd, source_fd: RawFd) -> Self {
|
||||
}
|
||||
impl IoData for IoFd {
|
||||
fn io_mode(&self) -> IoMode {
|
||||
IoMode::fd
|
||||
IoMode::Fd
|
||||
}
|
||||
fn fd(&self) -> RawFd {
|
||||
self.fd
|
||||
@@ -251,7 +251,7 @@ pub fn new(fd: RawFd, file: File) -> Self {
|
||||
}
|
||||
impl IoData for IoFile {
|
||||
fn io_mode(&self) -> IoMode {
|
||||
IoMode::file
|
||||
IoMode::File
|
||||
}
|
||||
fn fd(&self) -> RawFd {
|
||||
self.fd
|
||||
@@ -283,7 +283,7 @@ pub fn new(fd: RawFd, is_input: bool, pipe_fd: OwnedFd) -> Self {
|
||||
}
|
||||
impl IoData for IoPipe {
|
||||
fn io_mode(&self) -> IoMode {
|
||||
IoMode::pipe
|
||||
IoMode::Pipe
|
||||
}
|
||||
fn fd(&self) -> RawFd {
|
||||
self.fd
|
||||
@@ -367,7 +367,7 @@ pub fn finish(filler: Arc<IoBufferfill>) -> SeparatedBuffer {
|
||||
}
|
||||
impl IoData for IoBufferfill {
|
||||
fn io_mode(&self) -> IoMode {
|
||||
IoMode::bufferfill
|
||||
IoMode::BufferFill
|
||||
}
|
||||
fn fd(&self) -> RawFd {
|
||||
self.target
|
||||
@@ -555,7 +555,7 @@ pub fn append_from_specs(&mut self, specs: &RedirectionSpecList, pwd: &wstr) ->
|
||||
|
||||
for spec in specs {
|
||||
match spec.mode {
|
||||
RedirectionMode::fd => {
|
||||
RedirectionMode::Fd => {
|
||||
if spec.is_close() {
|
||||
self.push(Arc::new(IoClose::new(spec.fd)));
|
||||
} else {
|
||||
@@ -578,7 +578,7 @@ pub fn append_from_specs(&mut self, specs: &RedirectionSpecList, pwd: &wstr) ->
|
||||
Err(err) => {
|
||||
if oflags.contains(OFlag::O_EXCL) && err == nix::Error::EEXIST {
|
||||
FLOGF!(warning, NOCLOB_ERROR, spec.target);
|
||||
} else if spec.mode != RedirectionMode::try_input
|
||||
} else if spec.mode != RedirectionMode::TryInput
|
||||
&& should_flog!(warning)
|
||||
{
|
||||
print_error(errno::errno().0, &spec.target);
|
||||
@@ -586,7 +586,7 @@ pub fn append_from_specs(&mut self, specs: &RedirectionSpecList, pwd: &wstr) ->
|
||||
// If opening a file fails, insert a closed FD instead of the file redirection
|
||||
// and return false. This lets execution potentially recover and at least gives
|
||||
// the shell a chance to gracefully regain control of the shell (see #7038).
|
||||
if spec.mode != RedirectionMode::try_input {
|
||||
if spec.mode != RedirectionMode::TryInput {
|
||||
self.push(Arc::new(IoClose::new(spec.fd)));
|
||||
have_error = true;
|
||||
continue;
|
||||
@@ -762,7 +762,7 @@ pub fn new(fd: RawFd) -> Self {
|
||||
assert!(fd >= 0, "Invalid fd");
|
||||
FdOutputStream {
|
||||
fd,
|
||||
sigcheck: SigChecker::new(Topic::sighupint),
|
||||
sigcheck: SigChecker::new(Topic::SigHupInt),
|
||||
errored: false,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user