-
Notifications
You must be signed in to change notification settings - Fork 7.3k
process.stdout.on('resize') delayed ~100ms #9032
Comments
I tested the code on my machine and I had the same issue. I also used a mac to do so. When I resized the window fast numbers are printing out as expected, but when I resize fast and stop, the final number prints after a short delay. I just took a quick look at https://github.com/joyent/node/blob/master/src/node.js#L505 and it seems the event |
I have tested it as well. I have no delay on OS X Yosemite 10.10.1. ^^ Sorry I was mistaken. I was using iojs, not node. |
Could any of you test this PR: #9179 and let me know if it fixes the problem? |
@trevnorris I checked out and that doesn't solved the problem. There is still delays for the final result. I also tested the problem against |
@bnoordhuis Calling you in, since this also affects io.js. Any ideas why this could be happening? |
It sounds like it could be either a Terminal.app quirk or a delay between libuv receiving the signal and the signal bubbling up to JS land. Libuv uses the self-pipe trick: the signal handler writes a message to a pipe, which wakes up the thread that makes the call into JS land. I would start by timing the gap between receipt of the signal and the event loop waking up. I don't know if there's a dtrace/dtruss trick for that but on Linux, you would use |
I just tested this with your PR #9179 as well as io.js v1.2.0 and still find this issue exists. Is anyone able to test this on Windows or Linux to see if it exists there too? Or is this only Mac specific? |
The weird thing is if we resize the terminal fast, bunch of |
I just tested this on Ubuntu Desktop 14.04, and it doesn't present this issue at all. |
I'm on OS X 10.10, using the terminal app, though I'm not sure if that has to do with anything.
Tried with node 0.10.35, and latest 0.11.14
It seems the event called when the terminal is resized is delayed by about ~100ms. To demonstrate: I'm simply logging the current column width when the terminal resizes, using the code below:
It seems when I resize the window really fast, the event is fired quickly and as expected, but then there is a final delay of about 100ms and it fires the last event with an accurate number of columns.
If I drag the window slowly there is also a 100ms delay.
Is this a system level thing? Is there any way to update the columns faster than they are currently being reported? A good example of a responsive application would be
top
, you can see that it responds to the terminal width instantaneously.Please let me know if I can help more in any way!
Thanks
The text was updated successfully, but these errors were encountered: