Skip to content
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

Enclose the app path in quotes, so that the open command doesn't split it if it contains spaces #678

Merged
merged 2 commits into from
Dec 28, 2020

Conversation

sergi
Copy link

@sergi sergi commented Dec 17, 2020

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

When running npx react-native run-macos (or locally node node_modules/react-native-macos/local-cli/cli.js run-macos) and if the target app has spaces in the name, the current call to the open macOS command will split the path and only keep the last part as the name in the app, which will fail:

...
▸ Build Succeeded
info Launching app "io.sergi.todolist" from "/Users/sergi/Library/Developer/Xcode/DerivedData/Todo_List-efowxgkzzzbxtgeghbplezporgmk/Build/Products/Debug/Todo List.app"
error Failed to launch the app, The file /Users/sergi/code/todo_list/macos/List.app does not exist.

This fix surrounds the path in quotes, which is the standard way to deal with spaces in the path. It solves the issue and introduces no other effects.

Changelog

[macOS] [Fixed] - Fixes CLI failing to launch app if the path contains spaces

Test Plan

This fix requires no further testing, as it only encloses a file path in quotes, keeping the exact same previous functionality, and preventing spaces from making open command misbehave.

Microsoft Reviewers: Open in CodeFlow

@sergi sergi requested a review from alloy as a code owner December 17, 2020 13:56
@sergi sergi changed the title Enclose the app path in quotes, so that the open command doesn't split if it contains spaces Enclose the app path in quotes, so that the open command doesn't split it if it contains spaces Dec 17, 2020
Copy link
Member

@alloy alloy left a comment

Choose a reason for hiding this comment

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

Thanks! 🙏

Perhaps even better would have been if we were to use execFile here, i.e. not spawn a shell at all, but this is a good iterative fix on its own 👍

PS: If you’d like to see this in a v0.63.x stable release, it would be great if you could send the same PR to the 0.63-stable branch.

@ghost
Copy link

ghost commented Dec 18, 2020

CLA assistant check
All CLA requirements met.

@alloy
Copy link
Member

alloy commented Dec 18, 2020

Btw, be sure to sign the CLA.

@sergi
Copy link
Author

sergi commented Dec 18, 2020

Signed, thanks!

@sergi
Copy link
Author

sergi commented Dec 18, 2020

@alloy I see a homebrew-related fix has been commited to this PR. Is it related?

@alloy
Copy link
Member

alloy commented Dec 28, 2020

Nope, that was to fix an earlier CI failure. I think this failure is a flunk, so I’m re-running the failed task.

@alloy alloy merged commit b192f9c into microsoft:master Dec 28, 2020
HeyImChris pushed a commit to HeyImChris/react-native-macos that referenced this pull request Feb 24, 2021
…lit it if it contains spaces (microsoft#678)

* Enclose the app path in quotes, so that the `open` command doesn't split it if it contains spaces

* [ado] Remove no longer needed homebrew fix

Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>
HeyImChris pushed a commit to HeyImChris/react-native-macos that referenced this pull request Feb 26, 2021
…lit it if it contains spaces (microsoft#678)

* Enclose the app path in quotes, so that the `open` command doesn't split it if it contains spaces

* [ado] Remove no longer needed homebrew fix

Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>
HeyImChris added a commit that referenced this pull request Feb 26, 2021
* Add nullability checks (#704)

* Update RCTCxxBridge.mm

* add nullability checks

* CI should run on PRs to future stable branches (#718)

* Enclose the app path in quotes, so that the `open` command doesn't split it if it contains spaces (#678)

* Enclose the app path in quotes, so that the `open` command doesn't split it if it contains spaces

* [ado] Remove no longer needed homebrew fix

Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>

* update podfile.lock

* Enclose the app path in quotes, so that the `open` command doesn't split it if it contains spaces (#678)

* Enclose the app path in quotes, so that the `open` command doesn't split it if it contains spaces

* [ado] Remove no longer needed homebrew fix

Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>

* update podfile.lock

* windows dep updates to 63

Co-authored-by: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
Co-authored-by: Sergi Mansilla <sergi@sergimansilla.com>
Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>
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