Skip to content

fix: iina next button hanging#1552

Merged
port19x merged 5 commits intopystardust:masterfrom
Dhairya3391:fix-iina-next-button-hanging
Sep 15, 2025
Merged

fix: iina next button hanging#1552
port19x merged 5 commits intopystardust:masterfrom
Dhairya3391:fix-iina-next-button-hanging

Conversation

@Dhairya3391
Copy link
Copy Markdown
Contributor

Pull Request Template

Type of change

  • Bug fix
  • Feature
  • Documentation update

Description

Fixes IINA hanging issue when using the Next button with existing instances.

Problem: When using the Next button in ani-cli with IINA player on macOS, the program hangs after the sed call if there's already an existing IINA instance running. This only occurs when IINA is already open.

Root Cause: The --keep-running flag conflicts with existing IINA instances, and the wait command can cause deadlocks with IINA processes.

Solution:

  • Instance Detection: Check if IINA is already running using pgrep -f "IINA"
  • Conditional Launch: Skip --keep-running flag when IINA instance already exists
  • Wait Command Fix: Skip wait for IINA when using external menu to prevent hanging

Environment Tested:

  • Version: 4.10.3
  • OS: MacOS
  • Shell: zsh
  • Player: IINA

Checklist

  • any anime playing
  • bumped version

  • next, prev and replay work
  • -c history and continue work
  • -d downloads work
  • -s syncplay works
  • -q quality works
  • -v vlc works
  • -e (select episode) aka -r (range selection) works
  • -S select index works
  • --skip ani-skip works
  • --skip-title ani-skip title argument works
  • --no-detach no detach works
  • --exit-after-play auto exit after playing works
  • --nextep-countdown countdown to next ep works
  • --dub and regular (sub) mode both work
  • all providers return links (not necessarily on a single anime, use debug mode to confirm)

  • -h help info is up to date
  • Readme is up to date
  • Man page is up to date

Additional Testcases

  • The safe bet: One Piece
  • Episode 0: Saenai Heroine no Sodatekata ♭
  • Unicode: Saenai Heroine no Sodatekata ♭
  • Non-whole episodes: Tensei shitara slime datta ken (ep. 24.5, ep. 24.9)
  • All Providers: Youkoso Jitsuryoku Shijou Shugi no Kyoushitsu e (TV) (3 m3u8, 3 mp4, 1 fast4speed, 1 sharepoint)
  • The examples of the help text

@port19x port19x changed the title Fix iina next button hanging fix: iina next button hanging Jul 25, 2025
Copy link
Copy Markdown
Collaborator

@port19x port19x left a comment

Choose a reason for hiding this comment

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

Also bump the version.

Not sure why you're version bumping patch in the readme, but I'll allow it

Comment thread ani-cli
Comment thread ani-cli Outdated
@port19x
Copy link
Copy Markdown
Collaborator

port19x commented Jul 31, 2025

Ah I see. You bumped the patch version in the readme in #1544 but continued along that branch without updating your fork first, thats why this PR would recommit that change

@MikeStrike101
Copy link
Copy Markdown

why is this PR not getting merged?

@port19x
Copy link
Copy Markdown
Collaborator

port19x commented Aug 26, 2025

Good question. I vaguely recall having tested this and it doing something while not breaking anything

Copy link
Copy Markdown
Collaborator

@port19x port19x left a comment

Choose a reason for hiding this comment

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

Sorry for all this delay.
I'm not gonna promise I'll react quickly to adapting the requested changes, but I do plan to get this merged this week.
Thank you for your contribution and patience

Comment thread ani-cli Outdated
Comment thread ani-cli Outdated
@port19x port19x linked an issue Aug 26, 2025 that may be closed by this pull request
@Dhairya3391 Dhairya3391 requested a review from port19x September 9, 2025 09:31
@port19x
Copy link
Copy Markdown
Collaborator

port19x commented Sep 9, 2025

Did you read my prior review? You haven't implemented any of it yet

Dhairya3391 and others added 4 commits September 10, 2025 15:07
- Check for existing IINA instance using pgrep before launching
- Skip --keep-running flag when IINA instance already exists to prevent hanging
- Remove wait command for IINA when using external menu to avoid deadlocks
- This resolves the issue where clicking Next would hang after sed call
  when there's an existing IINA player instance running

Fixes the bug where:
- Version: 4.10.3, OS: MacOS, Shell: zsh, Player: IINA
- Next button hangs when IINA instance already open
- Works fine when no existing IINA instances

The fix detects running IINA processes and adjusts the launch parameters
accordingly to prevent process conflicts and hanging behavior.
Co-authored-by: port19 <port19@port19.xyz>
@Dhairya3391 Dhairya3391 force-pushed the fix-iina-next-button-hanging branch from a3234ee to f22df4a Compare September 10, 2025 09:41
@Dhairya3391
Copy link
Copy Markdown
Contributor Author

Sorry, I missed that earlier — now fixed: removed redundant pid handling, kept a single bare wait, and trimmed the IINA comment while keeping the --keep-running omission when an instance exists.

Comment thread ani-cli
@port19x port19x merged commit c8aa791 into pystardust:master Sep 15, 2025
9 checks passed
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.

Consecutive Playback Issues when using the 'Next' button Broken link in downloading patch in Steam Deck installation

3 participants