Skip to content

Fix update powershell feature on windows #2325

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

Merged

Conversation

TylerLeonhardt
Copy link
Member

PR Summary

fixes #2323

This uses the node runtime to fetch the MSI and then uses cmd to execute the MSI. This will also stop the PSIC and then restart it when the MSI is done.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • PR has tests
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

sessionManager.stop();

// Invoke the MSI via cmd.
const msi = spawn("cmd", [`/S /C ${msiDownloadPath}`], {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to use cmd, or is there a more direct way of invoking the MSI (or is there a reason not to)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about "msiexec", [ "/i", msiDownloadPath ]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Changed to msiexec


} else if (isMacOS) {
script = "brew cask upgrade powershell";
let script = "brew cask upgrade powershell";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible case for a ternary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ye

const msi = spawn("cmd", [`/S /C ${msiDownloadPath}`], {
detached: true,
cwd: os.homedir(),
env: process.env,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does spawn not pass the environment by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed. You're right

// Invoke the MSI via cmd.
const msi = spawn("cmd", [`/S /C ${msiDownloadPath}`], {
detached: true,
cwd: os.homedir(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does execution of the MSI depend on this setting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified

@TylerLeonhardt TylerLeonhardt force-pushed the fix-update-powershell-windows branch from d0beab0 to e3bff17 Compare November 26, 2019 17:49
@TylerLeonhardt TylerLeonhardt merged commit dba7d83 into PowerShell:master Nov 27, 2019
@TylerLeonhardt TylerLeonhardt deleted the fix-update-powershell-windows branch August 10, 2020 15:04
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

Successfully merging this pull request may close these issues.

Auto-update on Windows fails on default MSI options when executed from Core-based PSIC
3 participants