Browse Source

Force debug file to be written synchronously

Godzil 5 years ago
parent
commit
2459f342c5
1 changed files with 3 additions and 9 deletions
  1. 3 9
      src/log.ts

+ 3 - 9
src/log.ts

@@ -41,15 +41,9 @@ export function dumpToDebug(what: string, data: any, create = false)
 {
   if (create)
   {
-    fs.writeFile('debug.txt', '>>>>>>>> ' + what + ':\n' + data + '\n<<<<<<<<\n', (err) =>
-    {
-      if (err) throw err;
-    });
+    fs.writeFileSync('debug.txt', '>>>>>>>> ' + what + ':\n' + data + '\n<<<<<<<<\n');
     return;
   }
 
-  fs.appendFile('debug.txt', '>>>>>>>> ' + what + ':\n' + data + '\n<<<<<<<<\n', (err) =>
-  {
-    if (err) throw err;
-  });
-}
+  fs.appendFileSync('debug.txt', '>>>>>>>> ' + what + ':\n' + data + '\n<<<<<<<<\n');
+}