Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60959


Change subject: Fix race condition in 'fetch-parserTests.txt.js --force'.
......................................................................

Fix race condition in 'fetch-parserTests.txt.js --force'.

We were computing the SHA1 hash of the newly-downloaded file before
node has finished writing it and closing the file, which sometimes
caused the wrong hash to be written.

Change-Id: I51eac688d477af28ee7dc05092141d42520eecde
---
M js/tests/fetch-parserTests.txt.js
1 file changed, 9 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/59/60959/1

diff --git a/js/tests/fetch-parserTests.txt.js 
b/js/tests/fetch-parserTests.txt.js
index b62504d..e5fb521 100755
--- a/js/tests/fetch-parserTests.txt.js
+++ b/js/tests/fetch-parserTests.txt.js
@@ -53,14 +53,15 @@
                        out.write(data);
                });
                result.on('end', function() {
-                       if (out) {
-                               out.end();
-                               if (cb) {
-                                       return cb();
-                               } else if (expectedSHA1 !== 
computeSHA1(target_name)) {
-                                       console.warn('Parsoid expected 
sha1sum', expectedSHA1,
-                                                                'but got', 
computeSHA1(target_name));
-                               }
+                       out.end();
+                       out.destroySoon();
+               });
+               out.on('close', function() {
+                       if (cb) {
+                               return cb();
+                       } else if (expectedSHA1 !== computeSHA1(target_name)) {
+                               console.warn('Parsoid expected sha1sum', 
expectedSHA1,
+                                                        'but got', 
computeSHA1(target_name));
                        }
                });
        }).on('error', function(err) {

-- 
To view, visit https://gerrit.wikimedia.org/r/60959
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I51eac688d477af28ee7dc05092141d42520eecde
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <wikime...@cscott.net>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to