From f57634f087472e266702f57e7baa3dd066f4bd01 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Mon, 16 Nov 2015 17:07:42 +0000 Subject: [PATCH] Use raw_read()/raw_write() and go back to using socket_select() on !Win32. No longer blocks for an extra keypress at termination on *nix. Something like raw_poll or something will be needed to let Win32 work (and to avoid the silly socket_select(file) usage). --- exec/dorkit/jsexec_console.js | 3 +-- exec/dorkit/jsexec_input.js | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/exec/dorkit/jsexec_console.js b/exec/dorkit/jsexec_console.js index fe8f65c658..3fb9c00ec4 100644 --- a/exec/dorkit/jsexec_console.js +++ b/exec/dorkit/jsexec_console.js @@ -1,8 +1,7 @@ load("ansi_console.js"); dk.console.remote_io.print = function(string) { - stdout.write(string); - stdout.flush(); + stdout.raw_write(string); }; var jsexec_input_queue = load(true, "jsexec_input.js"); diff --git a/exec/dorkit/jsexec_input.js b/exec/dorkit/jsexec_input.js index 2b7d549037..940f0568ec 100644 --- a/exec/dorkit/jsexec_input.js +++ b/exec/dorkit/jsexec_input.js @@ -7,6 +7,13 @@ var k; while(!js.terminated) { if (parent_queue.poll(0)) break; - k = stdin.read(1); + if (system.platform == 'Win32') + k = stdin.raw_read(1); + else { + if (socket_select([stdin.descriptor], 0.1).length == 1) + k = stdin.raw_read(1); + else + k = undefined; + } ai.add(k); } -- GitLab