From c8c6241b96646ec186557268f5be114e776a5162 Mon Sep 17 00:00:00 2001 From: 132ikl <132@ikl.sh> Date: Sun, 5 Jan 2025 23:15:30 -0500 Subject: [PATCH] Add pipefail module --- stdlib-candidate/std-rfc/pipefail/mod.nu | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 stdlib-candidate/std-rfc/pipefail/mod.nu diff --git a/stdlib-candidate/std-rfc/pipefail/mod.nu b/stdlib-candidate/std-rfc/pipefail/mod.nu new file mode 100644 index 000000000..eacd880c9 --- /dev/null +++ b/stdlib-candidate/std-rfc/pipefail/mod.nu @@ -0,0 +1,16 @@ +export alias default-run-external = run-external + +export def --wrapped run-external [...rest: string] { + let results = default-run-external ($rest | first) ...($rest | skip 1) | complete + if $results.exit_code != 0 { + error make { + msg: "External command failed" + label: { + text: "command had a non-zero exit code", + span: (metadata $rest).span + } + } + } else { + $results.stdout + } +}