-
Notifications
You must be signed in to change notification settings - Fork 23
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
Attempt to fix osascript issue with launching Terminal #902
base: trunk
Are you sure you want to change the base?
Conversation
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.
} | ||
|
||
const escapedPath = targetPath.replace( /"/g, '\\"' ); | ||
initScriptSteps.push( `cd \\"${ escapedPath }\\"`, 'clear' ); |
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.
Hm, why do we do cleaning at the end?
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.
We have a separate issue to remove that https://github.com/Automattic/dotcom-forge/issues/10116
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.
why do we do cleaning at the end?
That's what I would expect as a user. Seeing setup commands in the terminal feels like exposing the app's inner workings.
NB that the osascript
is only needed for running the experimental WP CLI code. If we only want to open the terminal in the site directory, we could follow GitHub Desktop's implementation
🤦♂️ Looks like I failed to format the multiline string properly. Should be fixed now |
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.
It works well for me. However, it worked well, before, too.
Same here. I haven't been able to reproduce the issue. There's no guarantee that this will fix it, but escaping the |
Related issues
Proposed Changes
There are numerous reports in Sentry about
osascript
failing to run the command used to launch a Terminal from Studio. It's not clear why this happens, but in this PR, I've taken a few steps to make the script safer:;
instead of&&
to separate statements in the init script (proceed even if the previous step failed)osascript
instead of passing it as an argument toosascript -e
. Why? Because the manpage forosascript
mentions that the-e
argument technically only accepts single-line scripts:Testing Instructions
Open in… Terminal
button still works as expected on macOSPre-merge Checklist