Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Windows] time-out when writing while reading

See original GitHub issue

My expectation is, that when having the following code

'use strict';

const tk = require('terminal-kit').terminal;

tk('TEST\n> ');
    history: [],
}, (err, input) => {
    if (err) {
        throw err;
    console.log('Your input: ' + input);


I’d get an output of

> |

with the cursor at the pipe, or at least

> |

But terminal-kit fails with the error

C:\Users\marco_000\tmp>node test.js
        throw err;

Error: .getCursorLocation() timed out
    at Terminal.getCursorLocation (C:\Users\marco_000\tmp\node_modules\terminal-kit
    at init (C:\Users\marco_000\tmp\node_modules\terminal-kit\lib\inputField.js:198
    at Terminal.inputField (C:\Users\marco_000\tmp\node_modules\terminal-kit\lib\in
    at Object.<anonymous> (C:\Users\marco_000\tmp\test.js:6:4)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

cronvelcommented, Dec 23, 2016

Thanks for reporting. I assume you are using Windows from what I see in the error log (C:.) Windows terminals are awful, so I guess it doesn’t support retrieving the cursor location.

I will try to patch that soon, if it is possible…

cronvelcommented, Jun 9, 2018

@vrachels ??? I don’t get it… Writing to STDOUT is not supposed to trigger STDIN events synchronously, and BTW there is no thread. Windows does not work the way it should. Anyway, I trust you and I swapped the 2 lines.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timeout in Reading Serial Port - MSDN - Microsoft
When there is no data in serial port for five seconds, stop reading. I can read data from serial port. But when there...
Read more >
c++ - Win32 - read from stdin with timeout - Stack Overflow
The trick is that Windows places console events in the console input event queue. You've got to filter out the events you don't...
Read more >
Default timeout in Windows is currently undefined behavior #5
In short: Config.Timeout = 0, Linux does not time out, Windows times out at 0.5 seconds in my case. When Config.Timeout is left...
Read more >
Common Timeouts effecting Web Services, HTTP and SOAP ...
This timeout usually only occurs in situations where the writes are lagging behind new requests. This can occur when a client has a...
Read more >
How to Change the Lock Screen and Screen Saver Timeout ...
The Windows lock screen usually displays images when you power on your device or wake it from sleep mode. By default, the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found