- Version: v15.5.1 but using 14.15.4 LTS is the same
- Platform: Microsoft Windows NT 10.0.17763.0 x64
What steps will reproduce the bug?
Hi! I'm trying to use fs.watch on Windows to check for file change of the latest.log file of Minecraft. On Linux there is no problems, every time using this code it detects file change made by Minecraft and then I can do whatever I want with the file knowing that is has been modified. On Windows, however, it detects file change only when I open it with notepad or right-click it. It never emits a file change when Minecraft writes in it.
const fs = require('fs');
const fileLocation = 'C:/Users/username/AppData/Roaming/.minecraft/logs/latest.log';
let fsWait = false;
fs.watch(fileLocation, (event, filename) => {
if (filename) {
if (fsWait) return;
fsWait = setTimeout(() => {
fsWait = false;
}, 10);
console.log(`${filename} file Changed`);
}
});
How often does it reproduce? Is there a required condition?
When the file is in use by Minecraft/Java.
What is the expected behavior?
Getting logged that the file changed every time 'latest.log' get written to.
What do you see instead?
I'm getting logged that 'latest.log' gets written to only when I open it with notepad or when I right-click it.
Additional information
Using fs.watchFile works ok but I can't use it because of the CPU usage.
On Minecraft startup a file change is detected because the game deletes the latest.log and recreates it. But it should log a file modification each time the game adds a line in the log.
Sorry if this issue represents only the bug using Minecraft but I can't think of another realistic way.
What steps will reproduce the bug?
Hi! I'm trying to use fs.watch on Windows to check for file change of the latest.log file of Minecraft. On Linux there is no problems, every time using this code it detects file change made by Minecraft and then I can do whatever I want with the file knowing that is has been modified. On Windows, however, it detects file change only when I open it with notepad or right-click it. It never emits a file change when Minecraft writes in it.
How often does it reproduce? Is there a required condition?
When the file is in use by Minecraft/Java.
What is the expected behavior?
Getting logged that the file changed every time 'latest.log' get written to.
What do you see instead?
I'm getting logged that 'latest.log' gets written to only when I open it with notepad or when I right-click it.
Additional information
Using fs.watchFile works ok but I can't use it because of the CPU usage.
On Minecraft startup a file change is detected because the game deletes the latest.log and recreates it. But it should log a file modification each time the game adds a line in the log.
Sorry if this issue represents only the bug using Minecraft but I can't think of another realistic way.