fix(gatsby-telemetry): use windowsHide to not show windows command prompt windows #28258
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.
Description
This is quite weird issue - sometimes on Windows when using default "Command prompt" there would be cmd.exe windows popping up and immediately hiding (see videos in #28233 both from issue author and from me).
I used https://docs.microsoft.com/en-us/sysinternals/downloads/procmon to track down what those actually try to execute and found that it's our repository id getter function:
![Screenshot 2020-11-24 at 13 40 45](https://user-images.githubusercontent.com/419821/100095616-11c5a800-2e5b-11eb-9fb4-da4913d50fda.png)
childProcess.execSync
(and all the other similar too) havewindowsHide
option that is disabled by default, which I flip here to handle the issue.Seperate issue is that we call it multiple times - just from different processes, so memoization we have in
gatsby/packages/gatsby-telemetry/src/telemetry.ts
Lines 176 to 181 in e797658
And cherry on cake here is that at least for me - without this
windowsHide
toggle - I only see those command prompts windows popping up in some cases - in here it seems like after maingatsby develop
process dies / get killedRelated Issues
Fixes #28233