mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 03:27:45 +02:00
Rename IoStream
to OutDest
(#12433)
# Description I spent a while trying to come up with a good name for what is currently `IoStream`. Looking back, this name is not the best, because it: 1. Implies that it is a stream, when it all it really does is specify the output destination for a stream/pipeline. 2. Implies that it handles input and output, when it really only handles output. So, this PR renames `IoStream` to `OutDest` instead, which should be more clear.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::IoStream;
|
||||
use nu_protocol::OutDest;
|
||||
use std::thread;
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -118,7 +118,7 @@ impl Command for Complete {
|
||||
}]
|
||||
}
|
||||
|
||||
fn stdio_redirect(&self) -> (Option<IoStream>, Option<IoStream>) {
|
||||
(Some(IoStream::Capture), Some(IoStream::Capture))
|
||||
fn pipe_redirection(&self) -> (Option<OutDest>, Option<OutDest>) {
|
||||
(Some(OutDest::Capture), Some(OutDest::Capture))
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use super::run_external::create_external_command;
|
||||
use nu_engine::{command_prelude::*, current_dir};
|
||||
use nu_protocol::IoStream;
|
||||
use nu_protocol::OutDest;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Exec;
|
||||
@ -59,8 +59,8 @@ fn exec(
|
||||
call: &Call,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let mut external_command = create_external_command(engine_state, stack, call)?;
|
||||
external_command.out = IoStream::Inherit;
|
||||
external_command.err = IoStream::Inherit;
|
||||
external_command.out = OutDest::Inherit;
|
||||
external_command.err = OutDest::Inherit;
|
||||
|
||||
let cwd = current_dir(engine_state, stack)?;
|
||||
let mut command = external_command.spawn_simple_command(&cwd.to_string_lossy())?;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_cmd_base::hook::eval_hook;
|
||||
use nu_engine::{command_prelude::*, env_to_strings, get_eval_expression};
|
||||
use nu_protocol::{ast::Expr, did_you_mean, IoStream, ListStream, NuGlob, RawStream};
|
||||
use nu_protocol::{ast::Expr, did_you_mean, ListStream, NuGlob, OutDest, RawStream};
|
||||
use nu_system::ForegroundChild;
|
||||
use nu_utils::IgnoreCaseExt;
|
||||
use os_pipe::PipeReader;
|
||||
@ -225,8 +225,8 @@ pub struct ExternalCommand {
|
||||
pub name: Spanned<String>,
|
||||
pub args: Vec<Spanned<String>>,
|
||||
pub arg_keep_raw: Vec<bool>,
|
||||
pub out: IoStream,
|
||||
pub err: IoStream,
|
||||
pub out: OutDest,
|
||||
pub err: OutDest,
|
||||
pub env_vars: HashMap<String, String>,
|
||||
}
|
||||
|
||||
@ -523,7 +523,7 @@ impl ExternalCommand {
|
||||
RawStream::new(Box::new(ByteLines::new(err)), ctrlc.clone(), head, None)
|
||||
});
|
||||
|
||||
if matches!(self.err, IoStream::Pipe) {
|
||||
if matches!(self.err, OutDest::Pipe) {
|
||||
(stderr, stdout)
|
||||
} else {
|
||||
(stdout, stderr)
|
||||
@ -634,7 +634,7 @@ impl ExternalCommand {
|
||||
|
||||
// If the external is not the last command, its output will get piped
|
||||
// either as a string or binary
|
||||
let reader = if matches!(self.out, IoStream::Pipe) && matches!(self.err, IoStream::Pipe) {
|
||||
let reader = if matches!(self.out, OutDest::Pipe) && matches!(self.err, OutDest::Pipe) {
|
||||
let (reader, writer) = os_pipe::pipe()?;
|
||||
let writer_clone = writer.try_clone()?;
|
||||
process.stdout(writer);
|
||||
|
Reference in New Issue
Block a user