Skip to content

Allow passing extra arguments in with-environment.sh#54166

Open
davidliu wants to merge 1 commit into
react:mainfrom
davidliu:patch-1
Open

Allow passing extra arguments in with-environment.sh#54166
davidliu wants to merge 1 commit into
react:mainfrom
davidliu:patch-1

Conversation

@davidliu

@davidliu davidliu commented Oct 16, 2025

Copy link
Copy Markdown

Summary:

Addresses #54140.

This allows adding extra arguments when running a command with with-environment.sh.

Changelog:

[IOS|] [CHANGED] - Allow passing extra arguments in with-environment.sh

Test Plan:

Tested by changing the "Bundle React Native code and images" build phase in the ReproducerApp template to execute with an extra argument like so:

/bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE index.example"

Can observe that the subsequent command picks up the extra argument.

Also tested building normally, without the extra argument, works as expected.

Addresses react#54140.

This allows adding extra arguments when running a command with `with-environment.sh`.

Tested by changing the "Bundle React Native code and images" build phase in the ReproducerApp template to execute with an extra argument like so:

```
/bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE index.example"
```

Can observe that the subsequent command picks up the extra argument.
@meta-cla

meta-cla Bot commented Oct 16, 2025

Copy link
Copy Markdown

Hi @davidliu!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@react-native-bot

Copy link
Copy Markdown
Collaborator
Fails
🚫

📋 Verify Changelog Format - See Changelog format

Generated by 🚫 dangerJS against 335cdf6

@meta-cla

meta-cla Bot commented Oct 17, 2025

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 17, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 17, 2025
@cipolleschi

Copy link
Copy Markdown
Contributor

Hi @davidliu thanks for the PR.

There are some security concerns involved in this change. We are not sure that allowing to execute a command with an arbitrary set of arguments is safe.

Can you expand a little bit more on your use case? Why do you need to run the script with extra arguments?

@davidliu

Copy link
Copy Markdown
Author

Hi @cipolleschi, as outlined in #54140, my personal usecase is for the react-native-xcode.sh script, which can take an extra argument to specify the entry file during the iOS build process. I used it previously so that my index file could be written in typescript and thus would have a filename of index.ts.

It's not a big issue or anything though, just a minor inconvenience. I'm not really knowledgeable about the security issues here, but if there's actual concerns, feel free to close the PR.

@nicolas-rohricht

nicolas-rohricht commented Oct 20, 2025

Copy link
Copy Markdown

Hi @cipolleschi, as outlined in #54140, my personal usecase is for the react-native-xcode.sh script, which can take an extra argument to specify the entry file during the iOS build process. I used it previously so that my index file could be written in typescript and thus would have a filename of index.ts.

It's not a big issue or anything though, just a minor inconvenience. I'm not really knowledgeable about the security issues here, but if there's actual concerns, feel free to close the PR.

Worth mention that without @davidliu's suggested change I wasn't able to run app on physical devices even being in the same network as described here.

So, I'm not sure what should be the final fix in case this PR get's closed without any other suggested change.

@simon-thuresson-md

simon-thuresson-md commented Nov 26, 2025

Copy link
Copy Markdown

Hi!

We would really like to be able to pass arguments to the command. Our use case is with sentry which specifies this in there xcode build phase documentation:

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
SENTRY_XCODE="../node_modules/@sentry/react-native/scripts/sentry-xcode.sh"

/bin/sh -c "$WITH_ENVIRONMENT $SENTRY_XCODE"

where the sentry script sentry-xcode.sh takes and uses an argument like this

REACT_NATIVE_XCODE_DEFAULT="../node_modules/react-native/scripts/react-native-xcode.sh"
REACT_NATIVE_XCODE="${1:-$REACT_NATIVE_XCODE_DEFAULT}"

As we do not use the default path, we would like to specify our own. But, because the argument is not passed to the sentry script the default is used, and we are unable to use sentry without patch.

So in our case passing one argument would be sufficient, we would not need an arbitrary amount

Thanks in advance

@jenskuhrjorgensen

Copy link
Copy Markdown

Hi @cipolleschi

Is there any progress on this? I was just hit by this trying to update RN to 0.81.1. I'm also using Sentry so my problem is probably the same as reported by @simon-thuresson-md here:
#54166 (comment)

@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. Stale There has been a lack of activity on this issue and it may be closed soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants