Skip to content
Snippets Groups Projects
Commit f65769af authored by deuce's avatar deuce
Browse files

Use the global read() now that it's available in background threads.

parent ff2ce734
No related branches found
No related tags found
No related merge requests found
...@@ -3,29 +3,18 @@ js.load_path_list.unshift(system.exec_dir+"/dorkit/"); ...@@ -3,29 +3,18 @@ js.load_path_list.unshift(system.exec_dir+"/dorkit/");
load('ansi_input.js'); load('ansi_input.js');
var q = new Queue("dorkit_input"); var q = new Queue("dorkit_input");
var k; var k;
var f;
if(system.platform == 'Win32') {
f = new File('CON');
if(!f.open('rb', false, 0))
throw("Unable to open CON device!");
}
else {
f = new File('/dev/stdin');
if(!f.open('rb', false, 0))
throw("Unable to open /dev/stdin!");
}
while(!js.terminated) { while(!js.terminated) {
if (parent_queue.poll(0)) if (parent_queue.poll(0))
break; break;
// Can't select() files on Win32. // Can't select() files on Win32.
if(system.platform == 'Win32') { if(system.platform == 'Win32') {
k = f.read(1); k = read(1);
} }
else { else {
k = undefined; k = undefined;
if (socket_select([f.descriptor], 0.1).length == 1) if (socket_select([0], 0.1).length == 1)
k = f.read(1); k = read(1);
} }
if (k != undefined && k.length) if (k != undefined && k.length)
ai.add(k); ai.add(k);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment