mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
aaf973bbba
# Description In this PR I added two new methods to `Stack`, `stdout_file` and `stderr_file`. These two modify the inner `StackOutDest` and set a `File` into the `stdout` and `stderr` respectively. Different to the `push_redirection` methods, these do not require to hold a guard up all the time but require ownership of the stack. This is primarly useful for applications that use `nu` as a language but not the `nushell`. This PR replaces my first attempt #12851 to add a way to capture stdout/-err of external commands. Capturing the stdout without having to write into a file is possible with crates like [`os_pipe`](https://docs.rs/os_pipe), an example for this is given in the doc comment of the `stdout_file` command and can be executed as a doctest (although it doesn't validate that you actually got any data). This implementation takes `File` as input to make it easier to implement on different operating systems without having to worry about `OwnedHandle` or `OwnedFd`. Also this doesn't expose any use `os_pipe` to not leak its types into this API, making it depend on it. As in my previous attempt, @IanManske guided me here. # User-Facing Changes This change has no effect on `nushell` and therefore no user-facing changes. # Tests + Formatting This only exposes a new way of using already existing code and has therefore no further testing. The doctest succeeds on my machine at least (x86 Windows, 64 Bit). # After Submitting All the required documentation is already part of this PR.
54 lines
1.6 KiB
TOML
54 lines
1.6 KiB
TOML
[package]
|
|
authors = ["The Nushell Project Developers"]
|
|
description = "Nushell's internal protocols, including its abstract syntax tree"
|
|
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-protocol"
|
|
edition = "2021"
|
|
license = "MIT"
|
|
name = "nu-protocol"
|
|
version = "0.93.1"
|
|
|
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
|
|
[lib]
|
|
bench = false
|
|
|
|
[dependencies]
|
|
nu-utils = { path = "../nu-utils", version = "0.93.1" }
|
|
nu-path = { path = "../nu-path", version = "0.93.1" }
|
|
nu-system = { path = "../nu-system", version = "0.93.1" }
|
|
|
|
brotli = { workspace = true, optional = true }
|
|
byte-unit = { version = "5.1", features = [ "serde" ] }
|
|
chrono = { workspace = true, features = [ "serde", "std", "unstable-locales" ], default-features = false }
|
|
chrono-humanize = { workspace = true }
|
|
fancy-regex = { workspace = true }
|
|
indexmap = { workspace = true }
|
|
lru = { workspace = true }
|
|
miette = { workspace = true, features = ["fancy-no-backtrace"] }
|
|
num-format = { workspace = true }
|
|
rmp-serde = { workspace = true, optional = true }
|
|
serde = { workspace = true, default-features = false }
|
|
serde_json = { workspace = true, optional = true }
|
|
thiserror = "1.0"
|
|
typetag = "0.2"
|
|
|
|
[features]
|
|
plugin = [
|
|
"brotli",
|
|
"rmp-serde",
|
|
"serde_json",
|
|
]
|
|
|
|
[dev-dependencies]
|
|
serde_json = { workspace = true }
|
|
strum = "0.26"
|
|
strum_macros = "0.26"
|
|
nu-test-support = { path = "../nu-test-support", version = "0.93.1" }
|
|
pretty_assertions = { workspace = true }
|
|
rstest = { workspace = true }
|
|
tempfile = { workspace = true }
|
|
os_pipe = { workspace = true }
|
|
|
|
[package.metadata.docs.rs]
|
|
all-features = true
|