Wrap git/hg detectors in try-catch. See #905. #941
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #905 it was reported that people without mercurial had some trouble with
jest -o. I fixed that initially but on some system it seems likechildProcess.spawncan throw. It doesn't seem to happen on OS X locally but based on what I read aboutchildProcess.spawnI do believe it can throw. I think it is best to wrap it in a try-catch now – the worst thing that can happen is to report back as not a git or not an hg repo, which it won't be if the commands fail.I also took a note to write an integration test for this, now that we have integration tests. I will add a few in a follow up.
Test Plan:
Run
jest -owith changed files both in a git and hg repo.