-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
fix: CLI breaks process when pod install has not failed #3943
Conversation
lib/services/cocoapods-service.ts
Outdated
this.$errors.failWithoutHelp("CocoaPods or ruby gem 'xcodeproj' is not installed. Run `sudo gem install cocoapods` and try again."); | ||
} | ||
|
||
await this.$xcprojService.verifyXcproj(true); |
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.
boolean
variable passed as param 🙀 🙀 🙀 😶
await this.prepareCocoapods(pluginPlatformsFolderPath, pluginData, projectData); | ||
|
||
const projectRoot = this.getPlatformData(projectData).projectRoot; | ||
await this.$cocoapodsService.applyPluginPodfileToProject(pluginData, projectData, projectRoot); |
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.
This code was included in prepareCocoapods
method
if (opts && opts.executePodInstall && this.$fs.exists(pluginPodFilePath)) {
await this.executePodInstall(projectData);
}
but I can't see to call it in the new implementation. Maybe I'm missing something?
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.
opts
were never passed, so I just removed this code
The CocoapodsService is designed to execute all pod related operations, so move the `executePodInstall` method from `IosProjectService` to `CocoapodsService`.
In some cases `pod install` command prints data on the `stderr` (for example when setup the repo for the first time or when updating it). CLI detects the data on stderr and fails the operation. However these are not real errors. Fix this by passing `{ throwError: false }` to `spawnFromEvent` method. This way it will not fail in any case. Check the exit code of the operation and if it is not 0, just fail. Pipe the stderr of the `pod install` process to stdout of CLI, this way we'll not polute CLI's stderr with some unrelevant info. NOTE: `pod install` command prints the real errors on stdout, not stderr.
Add missing test for #3935
a970cbe
to
2db98d0
Compare
First commit:
refactor: move executePodInstall method to CocoapodsService
The CocoapodsService is designed to execute all pod related operations, so move the
executePodInstall
method fromIosProjectService
toCocoapodsService
.fix: CLI breaks process when pod install has not failed
The fix and related unit tests are in the second commit:
In some cases
pod install
command prints data on thestderr
(for example when setup the repo for the first time or when updating it). CLI detects the data on stderr and fails the operation. However these are not real errors.Fix this by passing
{ throwError: false }
tospawnFromEvent
method. This way it will not fail in any case. Check the exit code of the operation and if it is not 0, just fail.Pipe the stderr of the
pod install
process to stdout of CLI, this way we'll not polute CLI's stderr with some unrelevant info.NOTE:
pod install
command prints the real errors on stdout, not stderr.PR Checklist
What is the current behavior?
When
pod install
method prints some information on stderr (for example when this is the first execution of the command, it setups the master repo and prints progress indicator on stderr), CLI process stops with errorpod install failed...
.What is the new behavior?
CLI continues the execution in the mentioned scenario. CLI will stop only when
pod install
command exits with non-zero exit code.Fixes issue #3686