Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Add CWD parameter to child process spawn #2220

Merged
merged 3 commits into from
Jun 10, 2020

Conversation

RedMickey
Copy link
Contributor

Hello,
I am a maintainer of React Native Tools VS Code extension. The extension is used for debugging React Native (including Expo) applications.
We faced the issue, when we were trying to use dynamic project configuration and babel-plugin-dotenv-import. Our extension uses @expo/xdl package to start Expo server. But when the evalConfig method is being executed, we get an error that @env module doesn't exist. We found out that this happens due to incorrect CWD parameter in case of usage of this function within VS Code context. When we start the extension process.cwd isn't the same as the project root (on macOS it is /). But we found out that if we add correct CWD to spawn options, everything works fine.
This fix should increase the stability of evalConfig method work.

@superandrew
Copy link

watching this issue and supporting the PR!

@brentvatne
Copy link
Member

brentvatne commented Jun 3, 2020

this seems reasonable to me, thanks!

@RedMickey - would you be able to add a test case that covers the usage scenario you explained in your post, in order to ensure we don't regress on it?

cc @EvanBacon, will wait for you to approve

Copy link
Contributor Author

@RedMickey RedMickey left a comment

Choose a reason for hiding this comment

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

Hi @brentvatne, I've added tests to check process.cwd in a spawned child process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants