From 2fa5caa586dcc9703190f8ae715a94955b15a988 Mon Sep 17 00:00:00 2001 From: Hullabaloo-and-Howdy-Do <148780603+Hullabaloo-and-Howdy-Do@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:57:50 -0500 Subject: [PATCH] null-stream.nu as stdlib-candidate (#649) This is a way to redirect to a null stream with the same syntax regardless of platform. --- stdlib-candidate/null-stream.nu | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 stdlib-candidate/null-stream.nu diff --git a/stdlib-candidate/null-stream.nu b/stdlib-candidate/null-stream.nu new file mode 100644 index 00000000..224f036c --- /dev/null +++ b/stdlib-candidate/null-stream.nu @@ -0,0 +1,10 @@ +# Examples +# redirect to the null stream +# > echo foo out> (null-stream) +def null-stream []: nothing -> string { + if $nu.os-info.name == "windows" { + "NUL:" + } else { + "/dev/null" + } +}