jenkins-bot has submitted this change and it was merged.
Change subject: Sync output directories before bundling.
......................................................................
Sync output directories before bundling.
Ensure that the file metadata is recorded in the output directories before
we zip (or exit).
Change-Id: I25da59fbbda2148013e77c50ab64f0afcb13d020
---
M lib/index.js
1 file changed, 18 insertions(+), 0 deletions(-)
Approvals:
Cscott: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/index.js b/lib/index.js
index 6417700..4f09e56 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -289,6 +289,23 @@
);
};
+ // Promise to sync the various directories.
+ // Closing a file does *not* guarantee that the file's metadata (size,
etc)
+ // will be flushed to its containing directory. That can confuse
+ // zip! So let's ensure that the directories are all synced.
+ var syncOutputDirs = function() {
+ var syncDir = function(path) {
+ return P.call(fs.open, fs, path, 'r').then(function(fd)
{
+ return P.call(fs.fsync, fs, fd).then(function()
{
+ return P.call(fs.close, fs, fd);
+ });
+ });
+ };
+ return syncDir(imagedir).then(function() {
+ return syncDir(options.output);
+ });
+ };
+
// promise to create the desired bundle!
var createBundle = function() {
status.createStage(0, 'Creating bundle');
@@ -346,6 +363,7 @@
.then(writeMetabookNfoJson)
// stage 6
.finally(closeDatabases)
+ .then(syncOutputDirs)
.then(createBundle)
.then(function() {
status.createStage(0, 'Done');
--
To view, visit https://gerrit.wikimedia.org/r/151404
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I25da59fbbda2148013e77c50ab64f0afcb13d020
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection/OfflineContentGenerator/bundler
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits