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

Use "pwsh.exe" on Windows instead of the old "powershell.exe" in a non-breaking way #1185

Closed
frederikhors opened this issue May 15, 2022 · 4 comments

Comments

@frederikhors
Copy link

frederikhors commented May 15, 2022

I'm new to just. It's great! Really!

I'm a Windows 10 user and I'm using the "new" PowerShell 7 which has the executable name pwsh.exe.

I understood from the docs that I can set the below config on Windows to use Powershell instead of sh.exe (which is what I want since sh.exe on Windows is buggy for some things).

set windows-powershell

What is missing today (for what I can read from docs at least) is a way to indicate to Just what Powershell version to use based on what executable to use:

  1. the old buggy powershell.exe (which is currently used)
  2. or the new pwsh.exe which you can download & install from Microsoft website (and maybe is already installed on Windows 11).

I tried with these lines too but obviously they aren't working and they have no sense at all since on my linux I would use the default shell for linux:

shell := if os_family() == "windows" { "pwsh.exe" } else { "" }
set shell := ["{{shell}}", "-c"]

So I'm suggesting a non-breaking way to handle this using something like:

set windows-pwsh

Do you agree?

@casey
Copy link
Owner

casey commented May 15, 2022

I'm new to just. It's great! Really!

Thank you!

the old buggy powershell.exe (which is currently used)

So I have the background, what's buggy about the binary named powershell.exe? Also, what version is it? Is pwsh.exe a different version?

set windows-pwsh

That sounds reasonable to me, although it's unfortunate that there would be two very similar options.

@frederikhors
Copy link
Author

Sorry, I used a wrong term here ("buggy").

powershell.exe is the PowerShell 6.

pwsh.exe is the NEW PowerShell 7, faster and better (I can use many bash-similar commands, I can even use the && between commands).

although it's unfortunate that there would be two very similar options

Maybe we can use the same but if pwsh.exe is found we can use it.

Although maybe this can be slower?

@frederikhors frederikhors changed the title Use "pwsh.exe" on Windows instead of the old, buggy "powershell.exe" in a non-breaking way Use "pwsh.exe" on Windows instead of the old "powershell.exe" in a non-breaking way May 16, 2022
@casey
Copy link
Owner

casey commented May 17, 2022

Okay, I see. I think switching between pwsh.exe and powershell.exe automatically is probably a bad idea. As gross as it is, set windows-pwsh is probably the way to go.

@casey
Copy link
Owner

casey commented May 31, 2022

@frederikhors Just published 1.2.0, which has set windows-shell, which can be used to set the windows shell to whatever, including pwsh.exe. Let me know if it works for you!

@casey casey closed this as completed May 31, 2022
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

2 participants