-
Notifications
You must be signed in to change notification settings - Fork 57
Fix: PM2 start for paths with spaces #2495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I got the Studio app to run properly by applying this same change to |
|
Hey @funct7, welcome to the project and thanks for your first contribution! 🎉 Great find on the PM2 space-handling issue. Your analysis seems correct and PM2 incorrectly treats paths with spaces as shell commands. Your fix looks good, but I'd suggest another approach: we already patch PM2 for type fixes (cli/patches/pm2+6.0.14.patch), so we can fix the root cause directly in lib/Common.js with a one-line change: // Line 726 - add fs.existsSync check:
if (app.script && app.script.indexOf(' ') > -1 && cst.IS_WINDOWS === false && !fs.existsSync(app.script)) {This way:
Let me know if you'd like to update the PR with this approach or if you'd prefer I take it from here. Either way, thanks for tracking this down! 🙏 |
|
@bcotrim It's probably best if you took over since you seem to know a lot more about the code base. |
The original symlink approach worked but required runtime file management. This patches PM2's Common.js directly to check if the script file exists before wrapping paths with spaces in bash -c. Fixes Automattic#2482
|
Thanks for handing this over! I've pushed a commit that replaces the symlink approach with a PM2 patch. The patch adds a Tested manually by building the CLI, copying to |
|
Looks good. Let me know if there's anything to be done on my part. |
ivan-ottinger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good and works as expected. 👍🏼 Here's the behavior before / after:
Before:
CleanShot.2026-01-29.at.13.23.04.mp4
After:
Related issues
Proposed Changes
Testing Instructions
studio site createfrom a path that includes spaces (e.g., “WP Studio.app”) and confirm the WordPress server starts.Pre-merge Checklist