Comments (7)
π Problem can date back to 2009 PowerShell/PowerShell#16989 (comment)
Need to broadcast the change after updating env vars.
from install.
The function call is probably not needed
@r15ch13 the native SendMessageTimeout
function call is required, I just tested before your comment. π
refs:
https://stackoverflow.com/questions/6979741/setting-environment-variables-requires-reboot-on-64-bit
https://gist.github.com/alphp/78fffb6d69e5bb863c76bbfc767effda
https://github.com/AzureAD/microsoft-authentication-cli/pull/167/files
https://mnaoumov.wordpress.com/2012/07/24/powershell-add-directory-to-environment-path-variable/
https://www.powershellgallery.com/packages/PSCI/1.0.4/Content/core%5Cutils%5CUpdate-EnvironmentVariables.ps1
https://github.com/nodejs/node/pull/613/files
Edit:
PS. Windows Terminal still does not work even if an env broadcasting patch is applied to Scoop. Because the current (and previous) version(s) of WT does not listen for the WM_SETTINGCHANGE
message. And guess what, I noticed this yestoday seeing microsoft/terminal#14999 started last week and got merged few days ago. And I believe you will have to wait until next WT release if you are using WT. π
from install.
Can you provide a short explanation for setting up a test environment on Azure?
from install.
Can you provide a short explanation for setting up a test environment on Azure?
- Provision an Azure VM
- At left panel, open 'Run Command' under 'Operations' section.
- Select 'RunPowerShellScript', execute
Invoke-Expression "& {$(Invoke-RestMethod get.scoop.sh)} -RunAsAdmin"
- Close 'RunPowerShellScript' and reopen, execute
scoop --version
, 'scoop' command is unavailable.
In fact, it is caused by '$EnvRegisterKey.SetValue($name)'
does not affect.
When we execute:
Invoke-Expression "& {$(Invoke-RestMethod get.scoop.sh)} -RunAsAdmin"
scoop --version
in the same session, it's OK since they are in the same session, the$env:PATH = "$SCOOP_SHIMS_DIR;$env:PATH"
inAdd-ShimsDirToPath
affects.
After we execute
Invoke-Expression "& {$(Invoke-RestMethod get.scoop.sh)} -RunAsAdmin"
, even simply copy 'Write-Env' to 'RunPowerShellScript' console, the registry value is not changed. That's cause we cannot run scoop command in new sessions.
from install.
I don't have an azure vm to test, and may need other people to help solve it.
I just did some tests on my local virtual machine and made some discoveries, hope it helps.
Since the changes of #44 are mostly inherited from ScoopInstaller/Scoop#5395, and I didn't find a hidden problem in it, so maybe your problem is caused by this.
When there is no scoop in the environment variable, and using irm get.scoop.sh | iex similar commands to install scoop, my code will add the scoop dir to the Path, in fact it also adds.
But I donβt know why, if you use the right-click Windows start key (Windows 11) to invoke Powershell or use the search (Windows 11) to get cmd or Powershell, you canβt get new environment variables after installation.
But if you pin Windows Terminal inthe taskbar, the cmd/Powershell you get after clicking it can get new environment variables.
There are two other ways: restart or manually save the editor of the environment variable.
I think the session of the environment variable caused by the new code may be abnormal, but I don't have time to explore until the weekend (I donβt have time on weekdays).
It is worth mentioning that ScoopInstaller/Scoop will also be affected (can verify by installing Python, because installing Python will add new environment variables), so we need to fix this problem before upgrading to 0.3.2.
I am sorry for the trouble caused to you by my modification of the code, currently you can install scoop by using the historical version of install.ps1.
from install.
from install.
Changing the registry value is not enough.
This is why choco runs setx
and calls a user32.dll
function:
https://github.com/chocolatey/choco/blob/ac806ee5ce03dea28f01c81f88c30c17726cb3e9/src/chocolatey.resources/helpers/functions/Set-EnvironmentVariable.ps1#L99-L124
The function call is probably not needed, because we don't care what explorer.exe
does.
from install.
Related Issues (20)
- Enhance Scoop Installation for Chinese Users by Updating get.scoop.sh Redirect URL HOT 6
- [Bug] Installer should Respect transport protocol (git settings) HOT 6
- Invoke-Expression: Error HOT 9
- Check target path before installation HOT 5
- sei358
- [Bug] Cannot install Scoop HOT 2
- Check $env:PATH before installation
- Error installing git HOT 2
- Help
- Option for no side effects like updating the system path HOT 1
- Don't abort if already installed
- Abort when failing installation on CI
- Create `.gitignore` file in `scoop` directory
- Add support for other sources of Scoop app and main bucket HOT 2
- https://get.scoop.sh/ is down HOT 1
- Show single quotes in instructions while passing path arguments HOT 3
- [Bug] Installation Failure HOT 2
- [Bug] install.ps1 fails via ssh/headless, windows server 2022, ansible HOT 3
- installation *seems* to be ok, but many things don't work
- Install fail: Operation did not complete successfully because the file contains a virus or potentially unwanted software. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from install.