terminal-kit: [Windows] time-out when writing while reading
My 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)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 17 (5 by maintainers)
Commits related to this issue
- This may fix an incomprehensible Windows bug (#16) — committed to cronvel/terminal-kit by deleted user 6 years ago
- should provide a more insightful error when the terminal is not capable of requesting cursor location (#16) — committed to cronvel/terminal-kit by deleted user 6 years ago
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.