[Windows] time-out when writing while reading
See original GitHub issueMy expectation is, that when having the following code
'use strict';
const tk = require('terminal-kit').terminal;
tk('TEST\n> ');
tk.inputField({
history: [],
}, (err, input) => {
if (err) {
throw err;
}
console.log('Your input: ' + input);
});
tk('TEST2\n');
I’d get an output of
TEST
TEST2
> |
with the cursor at the pipe, or at least
TEST
> |
TEST2
But terminal-kit fails with the error
C:\Users\marco_000\tmp>node test.js
TEST
> TEST2
C:\Users\marco_000\tmp\test.js:10
throw err;
^
Error: .getCursorLocation() timed out
at Terminal.getCursorLocation (C:\Users\marco_000\tmp\node_modules\terminal-kit
\lib\Terminal.js:1118:50)
at init (C:\Users\marco_000\tmp\node_modules\terminal-kit\lib\inputField.js:198
:8)
at Terminal.inputField (C:\Users\marco_000\tmp\node_modules\terminal-kit\lib\in
putField.js:840:2)
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:
- Created 7 years ago
- Reactions:2
- Comments:17 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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…
@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.