Monitoring Feature not updating "automatically"
I was very glad to see the new Monitoring feature be added to Notepad++ 6.9.2.
I created a simple program that writes to a file, flushes, waits 500 ms, then repeats. I did this so I could see the refresh rate of this new tool.
It was not very impressive. After I initially opened the file it just stayed stationary. But it does change anytime the file gets focus the explorer window (if I deselected and reselected Notepad++ updates the file, but only then).
I am on Windows 10 Enterprise N x64 Version 1511 Build 10586.318
A lot of this has to due with the underlying OS and how it buffers file writes. I wrote a quick Python 2.7 script as follows:
import random import time import os with open("file.log", 'w') as f: while True: for i in range(100): f.write("Let's write some data " + str(random.randint(0,100)) + "\n") f.flush() os.fsync(f.fileno()) # This is important time.sleep(0.5)
Flushing does not necessarily write the contents to the disk. The important thing to note here is the call to
os.fsync(f.fileno()). This will force the file to be written to disk and cause Notepad++ to actually pick up on the changes.
I must be missing something here. I open cmd.exe and do ping -t 127.0.0.1 > out.txt. I launch Notepad++, open out.txt, and turn on Monitoring. The content just stays static. I open the same file periodically in regular notepad and, as one expects, it reflects the updated content each time. Cygwin’s tail -f also works fine.
That’s really odd. It’s doing the same for me…apparently it isn’t quite working completely yet :(
I also have the same behaviour, even on NPP7
Hello Bryan, dail and All,
AS for me, on my old XP SP3 configuration, your exact test, Bryan is working fine !!
I opened N++, in a full screen window
Then, I opened a classical DOS window, not in full screen size
If I type the command
ping -t 127.0.0.1, my XP system answers, every second about, the message "Réponse de 127.0.0.1 : octets=32 temps<1ms TTL=128 ( in French ! )
So, I start, again, this command
ping -t 127.0.0.1 > out.txt, with the file redirection
Then, I opened the out.txt file in N++ and set the option View - Monitoring (tail -f)
After a couple of seconds, I saw the repeated message, as above, and I could notice that the line numbers were increasing, each second about, as expected :-))
Moreover, after putting, again, the DOS window in the foreground, in order to both see the N++ editor window and the DOS window, I hit, several times, the combination
CTRL + Attn. As expected, the statistics were displayed, as soon as I used this shortcut, at the bottom of the N++ window of the current file out.txt !
I don’t know what’s happening on your W7, W8 or W10 systems, on this matter ? Or, may be, this occurs, only, on X64 configurations ?
Here is, below, my Debug Info :
Notepad++ v7 (32-bit) Build time : Sep 1 2016 - 02:21:07 Path : C:\_700\notepad++.exe Admin mode : OFF Local Conf mode : ON OS : Windows XP Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll PluginManager.dll
Here`s the same behavior on java execution inside Eclipse with stdout redirected to a file. I’m using x64 Win7. Cygwin also tailing -f normally.
Must be someway to force the OS to flush?