-
-
Notifications
You must be signed in to change notification settings - Fork 639
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
feat: add isWSL
function to detect if Task is being ran on WSL
#1731
Comments
isWSL
function to detect if Task is being ran on WSL
Hey @ssbarnea, Can we reliably detect that a Linux binary is ran under WSL? If so, we can consider adding another template function. I wouldn't change the |
We can get some inspiration from https://github.com/scivision/detect-windows-subsystem-for-linux There's potential to publish this on a standalone Go package on its own repository, so other people can benefit from it. |
I like the idea @andreynering |
This is something that will come really useful to support Windows devices as well as Linux and Mac, without fully rewriting a lot of task commands to use Powershell. |
If you run running Task in/under the WSL then the OS is linux. @ssbarnea why exactly do you need to know your Windows platform? Especially when you are running commands in Linux. If you are building software then, without question, you will need some kind of cross compiler. This is a normal thing and there are ways to deal with that (typically using environment variables). In terms of detecting WSL ... I would suggest one of these ENVARS: HOSTTYPE=x86_64 which will (probably**) be available to you when Task is running in WSL. ** Here I mean WSL Version 2 (version 1 is well in the past). |
It seems that the platform is evaluated as "linux" instead of "windows" or at least something as "wsl" when you run taskfile on windows under wsl.
I am not totally surprised by this but it is still incorrect as it does not allow us to properly identify windows platform when we executed commands under wsl (we are forced to do that due to the build chain).
The text was updated successfully, but these errors were encountered: