Skip to content

Stop macOS startup from hanging on a stuck login shell - #5333

Open
Gabriel Dufresne (GabrielDuf) wants to merge 3 commits into
mainfrom
fix/5236-macos-startup-path-hang
Open

Stop macOS startup from hanging on a stuck login shell#5333
Gabriel Dufresne (GabrielDuf) wants to merge 3 commits into
mainfrom
fix/5236-macos-startup-path-hang

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request improves the reliability and responsiveness of application startup on macOS by making the environment preparation asynchronous, adding robust timeout handling for login shell commands, and introducing a new utility method for safely reading process output. It also includes comprehensive tests for the new process output logic.

macOS startup improvements:

  • The environment preparation step (PrepareForCurrentPlatform) is now run asynchronously on macOS to prevent the UI from freezing if the login shell hangs or is slow. The main window is only created after this step completes, and the app respects quit requests during startup.
  • The logic for expanding the PATH variable on macOS now uses a timeout and improved error handling, ensuring that a stuck or slow shell does not block startup. Warnings are logged if the PATH cannot be read.

Process output handling:

  • Added a new utility method CoreTools.TryReadStandardOutput that runs a command, waits for its output up to a given timeout, and kills the process tree if the timeout elapses. This prevents deadlocks when child processes hang.

Testing:

  • Introduced ProcessOutputTests to verify that TryReadStandardOutput works as expected, including handling of normal output, timeouts, and non-existent commands.

Codebase organization:

  • Minor refactoring: imports and comments updated to support the above changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves macOS startup resilience by preventing stalled login shells from blocking the UI.

Changes:

  • Moves macOS environment preparation off the UI thread.
  • Adds timeout-based process output handling and process-tree termination.
  • Adds cross-platform process-output tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/UniGetUI.Core.Tools/Tools.cs Adds timed process-output utility.
src/UniGetUI.Core.Tools.Tests/ProcessOutputTests.cs Tests output, timeout, and launch failures.
src/UniGetUI.Avalonia/Infrastructure/ProcessEnvironmentConfigurator.cs Applies timeout handling to macOS PATH expansion.
src/UniGetUI.Avalonia/App.axaml.cs Makes macOS environment initialization asynchronous.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/UniGetUI.Core.Tools/Tools.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/UniGetUI.Core.Tools/Tools.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "de02ea50-a320-11f1-9e12-7427f864037c",
	"headSha": "5e7791c247ad9aa987ef5609d858db034162da34",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants