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

special-case two paths, /dev/tty and /dev/null, on Windows #1633

Closed
krader1961 opened this issue Dec 23, 2022 · 3 comments
Closed

special-case two paths, /dev/tty and /dev/null, on Windows #1633

krader1961 opened this issue Dec 23, 2022 · 3 comments

Comments

@krader1961
Copy link
Contributor

There was a recent IM discussion pointing out the challenge of writing an Elvish program that needs to use the UNIX paths /dev/tty and /dev/null on Windows. On Windows the equivalent are con and nul (or //./con and //./nul if using UNC names). It's a PITA to deal with this in a portable manner so it was suggested that it would be helpful if Elvish implicitly converted the UNIX device names to their Windows equivalent. Alternatively, have builtin vars that expand to the appropriate string for each platform; e.g., DevNul and DevTty. As a long time UNIX programmer I don't like that option but include it for discussion since it is explicit and avoids introducing behavior that might surprise a Windows programmer.

@dunsany
Copy link
Contributor

dunsany commented Jan 1, 2023

Wouldn't $path:dev-tty and $path:dev-null (and maybe $path:con and $path:nul) be appropriate places for this? Putting these variables in the global scope seems wrong, and PascalCase isn't used anywhere in Elvish.

@krader1961
Copy link
Contributor Author

Wouldn't $path:dev-tty and $path:dev-null (and maybe $path:con and $path:nul) be appropriate places for this?

Agreed, assuming we want to go the variable route. And having slept on the matter I'm now leaning towards variables rather than magically special-casing the /dev pathnames since doing so is likely to be hard to document in a discoverable fashion. Not to mention it feels wrong to privilege the UNIX device names and not the Windows equivalents.

@xiaq
Copy link
Member

xiaq commented Jan 4, 2023

Yes, variables are the way to go.

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

No branches or pull requests

3 participants