Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

process.stdout.on('resize') delayed ~100ms #9032

Closed
@arjunmehta

Description

@arjunmehta

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:

process.stdout.on('resize', function() {
    console.log(process.stdout.columns);
});

setInterval(function(){}, 1000); // just to keep the script running

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions