-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Feature Request] Sys.iswsl() #36354
Comments
Note that this would be different from all other |
(It's more similar to detection of linux distribution) |
@yuyichao why this would be a runtime detection? How does exactly OS is detected in Julia please help me understand. |
Because you are not running a different binary from the linux one.
This has nothing to do with why it needs to be done at runtime. It has to be done at runtime simply because this is a runtime property. It is not known at compile time and it can't be stored in the code as a constant. There's nothing special about OS detection in julia. In fact there is none. All what |
We can check the version/release of Linux during compile time which will tell us if its wsl ? see microsoft/WSL#4071 (comment) |
No that's the wrong thing to do, that cannot tell you if you are running at runtime. Again, it isn't about how to do the detection, it's about when to do the detection. The detection must be done after you download the binary from https://julialang.org/downloads/ when you start julia. It cannot be done when generating the binary you download. |
In another word, you don't care about whether your julia is compiled on WSL (it's not). You care about if it is running on WSL. And that's different from every other |
Okay thanks for clearing my confusion. I compile my Julia on wsl so I forgot that people download binaries 😄 |
I do think we need a WSL feature detection macro, since we will also need to start shipping WSL-specific CUDA binaries. We may want to rethink how |
I don't think any change to how Sys works is necessary. Adding this as runtime detection won't break anything. However, I do think there's currently an expectation that these are not runtime detection so I think a different name should be used for ones that are done at runtime to break that expectation. |
@yuyichao what should be its name? It will help since I want to work on it |
Maybe something with the word "detect" in it to indicate that active runtime detection is required for this. |
How about Then in the future more runtime detection methods could be added for things like containers as |
Background:
I am doing a project where I need to open Host system browser. The WSL is causing some problems if I detect it as Linux so I need to detect if Host is WSL to fix it.
While I can do someting like this: microsoft/WSL#4071 It would be convenient if we could have a Sys.iswsl() in Julia.
I would like to work on it myself but I couldn't understand Sys module .
The text was updated successfully, but these errors were encountered: