Skip to content

Fix headless CLI startup on macOS#167

Open
shanemesa wants to merge 1 commit intoTracktion:developfrom
shanemesa:codex/headless-cli-macos-fix
Open

Fix headless CLI startup on macOS#167
shanemesa wants to merge 1 commit intoTracktion:developfrom
shanemesa:codex/headless-cli-macos-fix

Conversation

@shanemesa
Copy link
Copy Markdown

Summary

This fixes a macOS CLI startup regression where pluginval could abort before handling command-line options. On macOS 26.4, both the current v1.0.4 release and current develop aborted on direct CLI startup, including pluginval --version, which also prevented headless validation in CI-like usage.

Problem

  • Direct CLI launch aborted before normal command handling:
    • pluginval --version
    • pluginval --strictness-level 5 --skip-gui-tests /path/to/plugin.vst3
  • The abort happened during app/bootstrap behavior that is unnecessary for CLI mode.
  • In local testing, the crash path involved macOS application registration during startup and also reproduced when the CLI path attempted to change dock/presentation state.

Approach

  • Route CLI mode before full JUCEApplication startup.
  • Keep the GUI app path unchanged.
  • Run CLI mode with a minimal headless JUCE/message-loop setup.
  • Avoid dock/presentation changes in CLI mode, because they force application registration on recent macOS builds and can break headless execution.
  • Add small tests for raw argv CLI detection so the custom entry path stays covered.

Scope

  • Source/Main.cpp
  • Source/CommandLine.h
  • Source/CommandLine.cpp
  • Source/CommandLineTests.cpp

Notes

  • This PR is intentionally narrow. It fixes CLI startup/routing and does not change validation logic.
  • GUI behavior is left on the existing JUCEApplication path.
  • AU discovery failures seen locally are separate from this startup fix.

Repro

Before this patch, on macOS 26.4:

pluginval --version

@drowaudio
Copy link
Copy Markdown
Contributor

Are you sure all of this is required? It seems like a lot of changes just to fix version reporting...
I can understand not calling hideDock, but why can't we have a normal juce application running headless?

@shanemesa
Copy link
Copy Markdown
Author

Are you sure all of this is required? It seems like a lot of changes just to fix version reporting... I can understand not calling hideDock, but why can't we have a normal juce application running headless?

Thanks, that’s fair.

--version was just the smallest repro. The real issue on my machine was that CLI startup in general was aborting on macOS 26.4, including --validate, so it was breaking headless validation, not just version reporting.

From the crash report, the abort was happening during JUCEApplicationBase::main / NSApplication startup, before initialise() ran. That’s why I didn’t stop at the dock call.

That said, I agree the patch may be broader than ideal. If you’d prefer, I can rework it into a smaller version that:

  • keeps the normal GUI app path unchanged
  • removes the dock/presentation change in CLI mode
  • keeps --version, --help, --run-tests, and --validate working
  • still exits cleanly with the right return code

I’d only want to do that if it still fixes real --validate runs on my machine, not just --version.

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.

2 participants