From bf925cfb88288a2438b7623da230f60e8c8212f2 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Thu, 28 Mar 2019 14:44:42 +0100 Subject: [PATCH] More async fixes the bug --- server.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/server.js b/server.js index 7ef38e0..e85ae7d 100644 --- a/server.js +++ b/server.js @@ -298,12 +298,19 @@ function startServer() { // If we're here, it means that we found the right path. We // will move the old one to the old directories, and save // the new one - fs.renameSync(path, movePath); + fs.rename(path, movePath, () => { - // Don't forget to copy the hashed password. - fs.copyFileSync( - pathtools.join(movePath, "__bcrypt__hash.txt"), - pathtools.join(path, "__bcrypt__hash.txt")); + console.log("copying from " + + pathtools.join(movePath, "__bcrypt__hash.txt") + + " to " + + pathtools.join(path, "__bcrypt__hash.txt")); + + // Don't forget to copy the hashed password. + fs.copyFileSync( + pathtools.join(movePath, "__bcrypt__hash.txt"), + pathtools.join(path, "__bcrypt__hash.txt")); + + }); break; }