diff options
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/41_prompt.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/js/41_prompt.js b/runtime/js/41_prompt.js index 137f17dcf..37fdaed77 100644 --- a/runtime/js/41_prompt.js +++ b/runtime/js/41_prompt.js @@ -37,12 +37,15 @@ function prompt(message = "Prompt", defaultValue) { return null; } - core.print(`${message} `, false); - if (defaultValue) { - core.print(`[${defaultValue}] `, false); + message += ` [${defaultValue}]`; } + message += " "; + + // output in one shot to make the tests more reliable + core.print(message, false); + return readLineFromStdinSync() || defaultValue; } |