App-Rakubrew icon indicating copy to clipboard operation
App-Rakubrew copied to clipboard

`rakubrew init` poor advice on Windows

Open 2colours opened this issue 1 year ago • 3 comments

Installing Rakubrew using . {iwr -useb https://rakubrew.org/install-on-powershell.ps1 } | iex in Powershell, the init advice is:

  1. not for Powershell
  2. it is not for Powershell even when explicitly running "C:\rakubrew\bin\rakubrew.exe init in a PowerShell window" as advised - by the way, would a Windows Terminal PS tab qualify as one? Anyway, didn't work with a plain Powershell window either.
  3. the CMD advice is overly fragile in my opinion - it's not obvious that it wouldn't work if you copied and pasted it into a batch file and ran that... as somebody who doesn't normally use CMD and Batch, it tripped me up big time. Since it's a multiline command and it's hard-coded into Rakubrew anyway, maybe it could actually generate a bat for it at least.

2colours avatar Aug 18 '23 12:08 2colours

The code to discern Powershell from CMD is:

# https://stackoverflow.com/a/8547234
my $psmodpath = $ENV{PSMODULEPATH};
my $userprofile = $ENV{USERPROFILE};
if (index($psmodpath, $userprofile) == 0) {
    return 'PowerShell';
}
else {
    return 'CMD';
}

Whoever observes this misbehavior: Can you provide the contents of the $env:PSMODULEPATH and $env:USERPROFILE env variables?

patrickbkr avatar Mar 08 '24 21:03 patrickbkr

I found an issue in the logic that causes misidentification on x86 Powershells. Fix is upcoming. Also the logic doesn't work on PS version 1. That shouldn't be an issue though (Ps 1 is Windows XP aera).

patrickbkr avatar Mar 14 '24 13:03 patrickbkr

Version 39 fixes an issue with misidentification of x86 PowerShell Windows. Unsure if the reporter observed that issue or a different one.

patrickbkr avatar Mar 15 '24 19:03 patrickbkr