Skip to content

Unify open folder - #770

Merged
z411 merged 3 commits into
masterfrom
feature/unify-open-folder
Mar 31, 2025
Merged

Unify open folder#770
z411 merged 3 commits into
masterfrom
feature/unify-open-folder

Conversation

@FichteFoll

Copy link
Copy Markdown
Collaborator

Continues the work of #727 but in a simpler fashion (as suggested in the review comments).

Since the code is identical for all UIs with the exception of determining the show id and error reporting, we move the common functionality to the engine and to a new small helper method in utils that defers to spawn_process (to re-use our already existing code to prevent zombie processes).

Because I had problems with the double-fork code for xdg-open here (unlike with mpv when playing episodes), I switched it to a different method that launches subprocesses normally via subprocess but also added a daemon thread to poll our created subprocesses and thus prevent them from remaining as zombies on *NIX OSes.

Supersedes and closes #727
Fixes #525
Fixes #508

The double fork method has some issues, notably that it is quite fragile
and that any errors that occur while spawning the process, e.g. that no
executable can be found with the requested name, are swallowed.

Instead, we use the saner workaround with a polling daemon thread that
simply polls all our spawned processes every 5 seconds to reap them if
they have exited. This has all the functionality that we desire with
the cost of just a simple background thread that does nothing most of
the time.

Fixes #525
Fixes #508
The code is identical for all UIs with the exception of determining the
show id and error reporting, so we move the common functionality to the
engine and to a new small helper method in utils that defers to
`spawn_process` (to re-use our already existing code to prevent zombie
processes).

Follow-up to #726
@z411

z411 commented Mar 31, 2025

Copy link
Copy Markdown
Owner

lgtm.

@z411
z411 merged commit 2695a50 into master Mar 31, 2025
@FichteFoll
FichteFoll deleted the feature/unify-open-folder branch April 1, 2025 18:09
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.

Playing episodes stopped working Launching player from trackma leaves zombie process on linux.

2 participants