Skip to content

Commit

Permalink
auth:export - Ensure all fetched and transformed data is written to f…
Browse files Browse the repository at this point in the history
…ile before exit (#1642)
  • Loading branch information
jpreynat authored and samtstern committed Sep 6, 2019
1 parent f1a411d commit 4324979
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Ensures `auth:export` results are fully flushed to the output file.
7 changes: 7 additions & 0 deletions src/commands/auth-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,12 @@ module.exports = new Command("auth:export [dataFile]")
writeStream.write("]}");
}
writeStream.end();
// Ensure process ends only when all data have been flushed
// to the output file
return new Promise(function(resolve, reject) {
writeStream.on("finish", resolve);
writeStream.on("close", resolve);
writeStream.on("error", reject);
});
});
});

0 comments on commit 4324979

Please sign in to comment.