summaryrefslogtreecommitdiff
path: root/cli/rt/41_prompt.js
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2020-11-03 09:15:29 +0900
committerGitHub <noreply@github.com>2020-11-03 01:15:29 +0100
commite736d0f60f6cdf38e2d317ee08a7125de9e57d69 (patch)
tree9d1970400946a7695e5b48dc120e947b9df438c7 /cli/rt/41_prompt.js
parent1c1889851d91807a1d480c79436dce4a32f61e9d (diff)
fix(prompt): fix display of non-ASCII characters on Windows (#8199)
Diffstat (limited to 'cli/rt/41_prompt.js')
-rw-r--r--cli/rt/41_prompt.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/cli/rt/41_prompt.js b/cli/rt/41_prompt.js
index 0adc6081a..ec294668b 100644
--- a/cli/rt/41_prompt.js
+++ b/cli/rt/41_prompt.js
@@ -1,18 +1,18 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
((window) => {
- const { stdin, stdout } = window.__bootstrap.files;
+ const { stdin } = window.__bootstrap.files;
const { isatty } = window.__bootstrap.tty;
const LF = "\n".charCodeAt(0);
const CR = "\r".charCodeAt(0);
- const encoder = new TextEncoder();
const decoder = new TextDecoder();
+ const core = window.Deno.core;
function alert(message = "Alert") {
if (!isatty(stdin.rid)) {
return;
}
- stdout.writeSync(encoder.encode(`${message} [Enter] `));
+ core.print(`${message} [Enter] `, false);
readLineFromStdinSync();
}
@@ -22,7 +22,7 @@
return false;
}
- stdout.writeSync(encoder.encode(`${message} [y/N] `));
+ core.print(`${message} [y/N] `, false);
const answer = readLineFromStdinSync();
@@ -36,10 +36,10 @@
return null;
}
- stdout.writeSync(encoder.encode(`${message} `));
+ core.print(`${message} `, false);
if (defaultValue) {
- stdout.writeSync(encoder.encode(`[${defaultValue}] `));
+ core.print(`[${defaultValue}] `, false);
}
return readLineFromStdinSync() || defaultValue;