Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: add cross platform null-device name #11070

Merged
merged 3 commits into from Nov 17, 2023
Merged

Conversation

WindSoilder
Copy link
Collaborator

Description

We have meet a discord discussion about cross platform null-device: https://discord.com/channels/601130461678272522/988303282931912704/1165966467095875624

I want the same feature too...And I think it's good enough to add it into nu-std.

Different to https://github.com/nushell/nu_scripts/pull/649/files, I think named it to null-device(the name comes from wiki) is better than null-stream.

Copy link
Member

@amtoine amtoine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once we land this new command, could you remove the null-stream command from the nu_scripts @WindSoilder ? 😇

crates/nu-std/std/mod.nu Outdated Show resolved Hide resolved
crates/nu-std/std/mod.nu Outdated Show resolved Hide resolved
crates/nu-std/std/mod.nu Outdated Show resolved Hide resolved
Copy link
Member

@amtoine amtoine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @WindSoilder for this and tweaking the code from review comments 🙏

@amtoine amtoine merged commit 5063e01 into nushell:main Nov 17, 2023
19 checks passed
@amtoine
Copy link
Member

amtoine commented Nov 17, 2023

so if you get a minute to remove the candidate in the nu_scripts, that'd be perfect 😌

fdncred pushed a commit to nushell/nu_scripts that referenced this pull request Nov 17, 2023
@Hullabaloo-and-Howdy-Do

Redirecting to the virtual path that Windows uses does the job, but I think the proper way of doing it is actually to redirect to NUL:

@ChrisDenton
Copy link
Contributor

\\.\NUL is the canonical win32 path, try using GetFullPathName on NUL. Things like NUL: are an old bit of wisdom from the days before UNC paths, device paths and file streams when it was used as an illegal file name that should always error if not redirected and thus shouldn't conflict with any real file. That's a more fragile assumption.

@Hullabaloo-and-Howdy-Do

\\.\NUL is the canonical win32 path, try using GetFullPathName on NUL. Things like NUL: are an old bit of wisdom from the days before UNC paths, device paths and file streams when it was used as an illegal file name that should always error if not redirected and thus shouldn't conflict with any real file. That's a more fragile assumption.

Ahh, interesting. I wasn't aware of that, I had trouble finding any documentation on the null device and the NUL: thing was the only detail I could find. Good to know.

hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Dec 14, 2023
# Description
We have meet a discord discussion about cross platform `null-device`:
https://discord.com/channels/601130461678272522/988303282931912704/1165966467095875624

I want the same feature too...And I think it's good enough to add it
into `nu-std`.

Different to https://github.com/nushell/nu_scripts/pull/649/files, I
think named it to `null-device`(the name comes from
[wiki](https://en.wikipedia.org/wiki/Null_device)) is better than
`null-stream`.
dmatos2012 pushed a commit to dmatos2012/nushell that referenced this pull request Feb 20, 2024
# Description
We have meet a discord discussion about cross platform `null-device`:
https://discord.com/channels/601130461678272522/988303282931912704/1165966467095875624

I want the same feature too...And I think it's good enough to add it
into `nu-std`.

Different to https://github.com/nushell/nu_scripts/pull/649/files, I
think named it to `null-device`(the name comes from
[wiki](https://en.wikipedia.org/wiki/Null_device)) is better than
`null-stream`.
@WindSoilder WindSoilder deleted the null_device branch February 27, 2024 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants