I [talked about this on 
Slack](https://cordova.slack.com/archives/C068CHRJ5/p1535978572000100). The 
nightly build are sometimes broken.

I believe that [the `readFile` 
call](https://github.com/apache/cordova-coho/blob/5d710a3bb1838d1e822ee0ed4f830374c6c4b180/src/versionutil.js#L134)
 is invoked and then [the `gitutil.pendingChangesExist()` call is 
made](https://github.com/apache/cordova-coho/blob/5d710a3bb1838d1e822ee0ed4f830374c6c4b180/src/versionutil.js#L166)
 right after. Both calls have asynchronous behavior, which introduces a race 
condition. I believe that this race condition is to blame for the random build 
failures.

Looking around the file, there is [at least another 
case](https://github.com/apache/cordova-coho/blob/5d710a3bb1838d1e822ee0ed4f830374c6c4b180/src/versionutil.js#L134)
 of this pattern. There might be more in the module if this is a general 
oversight by the author.

My suggestion is, given the generator/yield approach of the module, the 
workflow should be adapted to that or, for a smaller refactoring, the code 
should use `fs.readFileSync` instead. In the latter case, refactoring the code 
should be trivial. I could create a PR for that if there is consensus about the 
change.

[ Full content available at: https://github.com/apache/cordova-coho/issues/195 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to