Skip to content

[CmdPal] Close Gracefully#39589

Merged
davidegiacometti merged 1 commit intomainfrom
users/davidegiacometti/cmdpal-gracegfully-close
Jun 13, 2025
Merged

[CmdPal] Close Gracefully#39589
davidegiacometti merged 1 commit intomainfrom
users/davidegiacometti/cmdpal-gracegfully-close

Conversation

@davidegiacometti
Copy link
Collaborator

Summary of the Pull Request

CmdPal is leaking extensions processes as the process is immediately killed.
This PR fixes the 1.5s wait for the process to end correctly and also close extensions.

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

  • Verified that if CmdPal closes in 1.5s, extensions and process are closed (note that GitHub extension doesn't close probably due to cmdpal: fix a leak in the extension template #39209)
  • Verified that if CmdPal doesn't close in 1.5s the process is killed and extensions aren't closed (tested adding a delay in the code)

@davidegiacometti davidegiacometti added this to the PowerToys 0.92 milestone May 19, 2025
@davidegiacometti davidegiacometti self-assigned this May 19, 2025
@davidegiacometti davidegiacometti added the Product-Command Palette Refers to the Command Palette utility label May 19, 2025
@davidegiacometti davidegiacometti changed the title [CmdPal] Gracefully close [CmdPal] Close Gracefully May 19, 2025
@davidegiacometti
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@crutkas crutkas added the Needs-Review This Pull Request awaits the review of a maintainer. label May 21, 2025
Copy link
Contributor

@michaeljolley michaeljolley left a comment

Choose a reason for hiding this comment

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

LGTM, but would feel safer having @zadjii-msft give his blessing

@yeelam-gordon
Copy link
Contributor

@davidegiacometti and @michaeljolley, let's check-in it, the logic and definition looks good.
I think we already test the fix, which is all good.

@davidegiacometti davidegiacometti merged commit aa8cfd5 into main Jun 13, 2025
16 checks passed
@davidegiacometti davidegiacometti deleted the users/davidegiacometti/cmdpal-gracegfully-close branch June 13, 2025 17:57
yeelam-gordon pushed a commit that referenced this pull request Jun 20, 2025
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

CmdPal is leaking extensions processes as the process is immediately
killed.
This PR fixes the 1.5s wait for the process to end correctly and also
close extensions.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end user facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

- Verified that if CmdPal closes in 1.5s, extensions and process are
closed (note that GitHub extension doesn't close probably due to
#39209)
- Verified that if CmdPal doesn't close in 1.5s the process is killed
and extensions aren't closed (tested adding a delay in the code)
lei9444 pushed a commit that referenced this pull request Jul 14, 2025
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

This is an attempt to release Preview Handlers instantiated by Peek and
close the related processe.

⚠️ Note that even if the PR improve the current behavior, the solution
doesn't work 100% of times.
I noticed that sometimes the process gets leaked also when Preview
Handler is used in Explorer 🤔

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] **Closes:** #40117
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

- Ported the same fix applied to CmdPal to ensure the process is
terminated gracefully instead of being killed:
#39589
- Attempt to cleanup Preview Handlers and close the relative process

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Tested manually:
- Preview through some Excel and Word files
- Close Peek window
- Excel and Word processes are closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs-Review This Pull Request awaits the review of a maintainer. Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants