[PR #14421] [MERGED] Refactor ConsoleProcessList #30084

Open
opened 2026-01-31 09:38:34 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14421
Author: @lhecker
Created: 11/21/2022
Status: Merged
Merged: 12/2/2022
Merged by: @undefined

Base: mainHead: dev/lhecker/console-process-list-refactor


📝 Commits (6)

  • 76a1367 Refactor ConsoleProcessList
  • e1bb5ef Merge remote-tracking branch 'origin/main' into dev/lhecker/console-process-list-refactor
  • 2aef629 Address feedback
  • 6724ed1 Merge remote-tracking branch 'origin/main' into dev/lhecker/console-process-list-refactor
  • 1b967c3 Fix spelling
  • c686b11 Address feedback

📊 Changes

8 files changed (+146 additions, -206 deletions)

View changed files

📝 src/host/ft_fuzzer/fuzzmain.cpp (+0 -1)
📝 src/host/input.cpp (+15 -25)
📝 src/interactivity/win32/windowio.cpp (+3 -3)
📝 src/server/ApiDispatchersInternal.cpp (+0 -1)
📝 src/server/IoDispatchers.cpp (+0 -1)
📝 src/server/ProcessHandle.h (+9 -9)
📝 src/server/ProcessList.cpp (+111 -157)
📝 src/server/ProcessList.h (+8 -9)

📄 Description

This commit is just a slight refactor of ConsoleProcessList which I've noticed
was in a poor shape. It replaces iterators with for-range loops, etc.

Additionally this fixes a bug in SetConsoleWindowOwner, where it used to
default to the newest client process instead of the oldest.

Finally, it changes the process container type from a doubly linked list
over to a simple array/vector, because using linked lists for heap allocated
elements felt quite a bit silly. To preserve the previous behavior of
GetProcessList, it simply iterates through the vector backwards.

Validation Steps Performed

  • All unit/feature tests pass
  • Launching a TUI application inside pwsh inside cmd
    and exiting kills all 3 applications

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14421 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 11/21/2022 **Status:** ✅ Merged **Merged:** 12/2/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/console-process-list-refactor` --- ### 📝 Commits (6) - [`76a1367`](https://github.com/microsoft/terminal/commit/76a136770cf6e76edd848b502d45bbfad7519485) Refactor ConsoleProcessList - [`e1bb5ef`](https://github.com/microsoft/terminal/commit/e1bb5efc95ceda2fd72524587c02fb1af01d3870) Merge remote-tracking branch 'origin/main' into dev/lhecker/console-process-list-refactor - [`2aef629`](https://github.com/microsoft/terminal/commit/2aef6291da8d15ba4d68ef6907e65a65556ba109) Address feedback - [`6724ed1`](https://github.com/microsoft/terminal/commit/6724ed1e68863370052e584d6c24a615e394a129) Merge remote-tracking branch 'origin/main' into dev/lhecker/console-process-list-refactor - [`1b967c3`](https://github.com/microsoft/terminal/commit/1b967c3a9b0815225bcd3154e23464eb16d6ff4f) Fix spelling - [`c686b11`](https://github.com/microsoft/terminal/commit/c686b11aa5f1cf0f58d08c2f9700f2bfb5646da8) Address feedback ### 📊 Changes **8 files changed** (+146 additions, -206 deletions) <details> <summary>View changed files</summary> 📝 `src/host/ft_fuzzer/fuzzmain.cpp` (+0 -1) 📝 `src/host/input.cpp` (+15 -25) 📝 `src/interactivity/win32/windowio.cpp` (+3 -3) 📝 `src/server/ApiDispatchersInternal.cpp` (+0 -1) 📝 `src/server/IoDispatchers.cpp` (+0 -1) 📝 `src/server/ProcessHandle.h` (+9 -9) 📝 `src/server/ProcessList.cpp` (+111 -157) 📝 `src/server/ProcessList.h` (+8 -9) </details> ### 📄 Description This commit is just a slight refactor of `ConsoleProcessList` which I've noticed was in a poor shape. It replaces iterators with for-range loops, etc. Additionally this fixes a bug in `SetConsoleWindowOwner`, where it used to default to the newest client process instead of the oldest. Finally, it changes the process container type from a doubly linked list over to a simple array/vector, because using linked lists for heap allocated elements felt quite a bit silly. To preserve the previous behavior of `GetProcessList`, it simply iterates through the vector backwards. ## Validation Steps Performed * All unit/feature tests pass ✅ * Launching a TUI application inside pwsh inside cmd and exiting kills all 3 applications ✅ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:38:34 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30084