-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[Packaging] Fix #22741: az upgrade: This command becomes non-blocking on Windows
#26464
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
Changes from 2 commits
a7d5d28
5bbb874
fd1c702
14a80a5
11f4647
89f4f78
b049e8b
a65cb46
527123a
b2509e6
c8bb0f3
ffcd51d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,7 @@ def upgrade_version(cmd, update_all=None, yes=None): # pylint: disable=too-many | |
| from azure.cli.core.util import get_latest_from_github | ||
| try: | ||
| latest_version = get_latest_from_github() | ||
| local_version = '2.45.0' | ||
| if latest_version and parse(latest_version) <= parse(local_version): | ||
| logger.warning("You already have the latest azure-cli version: %s", local_version) | ||
| update_cli = False | ||
|
|
@@ -187,10 +188,12 @@ def _upgrade_on_windows(): | |
| """ | ||
| logger.warning("Updating Azure CLI with MSI from https://aka.ms/installazurecliwindows") | ||
| tmp_dir, msi_path = _download_from_url('https://aka.ms/installazurecliwindows') | ||
|
|
||
| logger.warning("Installing MSI") | ||
| import subprocess | ||
| exit_code = subprocess.call(['msiexec.exe', '/i', msi_path]) | ||
| subprocess.Popen(['msiexec.exe', '/i', msi_path]) | ||
| logger.warning("Installation started, please wait for a few minutes.") | ||
| import sys | ||
| sys.exit(0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As stated in the PR description, this makes us be unable to tell if the upgrade is successful. Better to confirm with PM whether this is an acceptable solution. Otherwise, we can develop some "upgrader.exe" written in C.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can create a upgrader to update az to prevent running az, but we need to call
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about it again and feel it is indeed not possible. A GUI application can have such Consider this invocation chain:
-> A contradiction! Consider the following code: import subprocess
p = subprocess.Popen(['python.exe', '-c', 'import time; time.sleep(3); print("awaken")'])
print('Exiting')Output: The first How to solve it? Wait for the subprocess to exit: import subprocess
p = subprocess.Popen(['python.exe', '-c', 'import time; time.sleep(3); print("awaken")'])
p.wait()
print('Exiting')Output:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly. I come up an idea to break the python dependency of Furthermore, we can write the upgrade logic in bat, it looks feasible. But is it worth writing dedicated logic for Windows? |
||
|
|
||
| if exit_code: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These below lines can never be reached, right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, they are not reachable. This is draft PR for test only currently. |
||
| logger.warning("Installation Failed. You may manually install %s", msi_path) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.