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

wrap irm-iex exprs in pwsh? #458

Closed
Gankra opened this issue Sep 27, 2023 · 1 comment · Fixed by #808
Closed

wrap irm-iex exprs in pwsh? #458

Gankra opened this issue Sep 27, 2023 · 1 comment · Fixed by #808
Labels
bug Something isn't working feature request New feature or request
Milestone

Comments

@Gankra
Copy link
Member

Gankra commented Sep 27, 2023

See also: axodotdev/oranda#393

We currently emit irm-iex (the windows version of curl-sh) exprs of the form:

irm https://github.com/axodotdev/oranda/releases/download/v0.4.1/oranda-installer.ps1 | iex

This expression only works in powershell, and will fail if pasted into e.g. cmd.exe. Wrapping it in "launch powershell" as follows would make it work more universally, though I don't know if there's Weird Implications:

pwsh -c "irm https://github.com/axodotdev/oranda/releases/download/v0.4.1/oranda-installer.ps1 | iex"
@Gankra Gankra added the feature request New feature or request label Sep 27, 2023
@Gankra Gankra added this to the 0.4.0 milestone Sep 27, 2023
@Gankra Gankra modified the milestones: 0.4.0, november 2023 Oct 26, 2023
@Gankra Gankra added the bug Something isn't working label Feb 1, 2024
@Gankra
Copy link
Member Author

Gankra commented Feb 1, 2024

addendum: the expression should be

powershell -c "irm https://github.com/axodotdev/oranda/releases/download/v0.4.1/oranda-installer.ps1 | iex"

(pwsh is the command for "PowerShell Core" aka "PowerShell 6+" which is not installed by default on windows, powershell is the name of "PowerShell" aka "PowerShell 5.1", which is installed by default on windows. Core is essentially an unrelated product in that its implementation and behaviour is arbitrarily divergent, because it was made from the groundup to be run on linux and macos portably. While 5.1 is windows-only and Forever Eternal For Compatibility.)


renewed interest in this solution: a few versions ago we cleaned up error handling and wrapped everything in a try-catch with "exit 1" in the catch block. this works great when you exec the powershell script locally, but the specifics of iem | iex invoking iex in the same way as Get-Content -Raw my-script.ps1 | iex.

Seemingly when invoked in this bytewise way, iex behaves more like source than sh, which hillariously/horribly means the exit 1 exits the user's shell.

Gankra added a commit that referenced this issue Feb 20, 2024
Gankra added a commit to axodotdev/oranda that referenced this issue Feb 20, 2024
konstin added a commit to astral-sh/uv that referenced this issue Feb 21, 2024
Recommend installing puffin with

```
powershell -c "irm https://github.com/axodotdev/cargo-dist/releases/latest/download/cargo-dist-installer.ps1 | iex"
```

instead of

```
irm https://github.com/axodotdev/cargo-dist/releases/latest/download/cargo-dist-installer.ps1 | iex
```

to support installing on cmd.exe, the classic non-powershell windows terminal.

See axodotdev/cargo-dist#458 for background. This will also be included in the next cargo-dist release.
konstin added a commit to astral-sh/uv that referenced this issue Feb 21, 2024
Recommend installing puffin with

```
powershell -c "irm https://github.com/axodotdev/cargo-dist/releases/latest/download/cargo-dist-installer.ps1 | iex"
```

instead of

```
irm https://github.com/axodotdev/cargo-dist/releases/latest/download/cargo-dist-installer.ps1 | iex
```

to support installing on cmd.exe, the classic non-powershell windows terminal.

See axodotdev/cargo-dist#458 for background. This will also be included in the next cargo-dist release.
konstin added a commit to astral-sh/uv that referenced this issue Feb 22, 2024
Recommend installing uv on windows with

```
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
```

instead of

```
irm https://astral.sh/uv/install.ps1 | iex
```

to support installing on cmd.exe, the classic non-powershell windows
command prompt.

See axodotdev/cargo-dist#458 for background.
This will also be included in the next cargo-dist release.

I have confirmed this passes on
 * Command Prompt
 * Windows PowerShell
 * PowerShell
 * git bash

Closes #1750

CC @12932 this fixes the uv command prompt installation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant