-
Notifications
You must be signed in to change notification settings - Fork 55
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
Don't understand WSL behaviour #101
Comments
I changed |
Hey, thanks for reporting this. Mask only checks for "powershell". Because it doesn't recognize "pwsh", it tries to fall back to assuming that command is on the system I think. If "pwsh" is a common form of that lang code, we should add a check for it in mask. |
This I do not know. PowerShell and pwsh are basically two different shells. PowerShell v5 comes preinstalled in Windows, while pwsh (or PowerShell-core or PowerShell v7) is cross platform and has to be installed manually. If the user creates a pwsh code block, mask could check if the pwsh shell is installed on the system and execute the command, otherwise fallback to the system shell (bash/powershell)? Cold this work? |
Yeah we can probably add some way to skip code blocks if the system doesn't have the expected executor installed. In general, I think that may lead to a bad user experience if we just silently ignore code blocks when the tool isn't installed. Some users would expect to see an error if the code block failed to execute.. new users probably want to know that they are missing a tool that the script expects. So we should either:
I'll have to consider this a bit further, but so far 3 might be the simplest option. |
Yup 3 looks easier. Maybe mask could also print that the executor is missing and that it's using the other one just to let the user know. |
The next release of mask will print a more helpful error when the executor is missing. After looking at the code again, in your case you have 2 code blocks which is causing the parser to loop over both and only stores the last one - this is why WSL is trying to run However, I have a solution similar to option 3 above but a little easier to reason about: if 2 code blocks are defined, macOS/linux will only check the first code block and expect that to work. And for windows, it'll use the final code block defined. This means that:
As long as all maskfiles follow this rule, things should work as expected. In terms of breaking changes, it would currently be a bug if someone wrote 2 code blocks and was only targeting macOS/linux - the first block never runs. However, if they wrote 2 code blocks and they always write the first one for Windows (powershell, cmd, batch), then this would be a breaking change for these users. I think this is completely fine to release for 0.12. So with that said, if anyone has time to take this, feel free. Otherwise I'll try to get to it at some point this year. We should only need to update this file. Removing the lang code checks (powershell, cmd, batch) and instead counting code block iterations. First block always is for macOS/linux platform, and for windows we check for a second code block. |
I have the following blocks in my maskfile:
Calling
mask install
on powershell core, the script works, calling it inside Ubuntu (in WSL), i get the following message:By commenting out the
pwsh
code block the script runs fine.I installed pwsh on WSL just to test it, and this is what i get:
The text was updated successfully, but these errors were encountered: