diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/permissions/prompter.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/permissions/prompter.rs b/runtime/permissions/prompter.rs index a73898835..ae07e004c 100644 --- a/runtime/permissions/prompter.rs +++ b/runtime/permissions/prompter.rs @@ -192,6 +192,11 @@ impl PermissionPrompter for TtyPrompter { return PromptResponse::Deny; // don't grant permission if this fails } + // Lock stdio streams, so no other output is written while the prompt is + // displayed. + let _stdout_guard = std::io::stdout().lock(); + let _stderr_guard = std::io::stderr().lock(); + // print to stderr so that if stdout is piped this is still displayed. const OPTS: &str = "[y/n] (y = yes, allow; n = no, deny)"; eprint!("{} ┌ ", PERMISSION_EMOJI); @@ -238,6 +243,9 @@ impl PermissionPrompter for TtyPrompter { }; }; + drop(_stdout_guard); + drop(_stderr_guard); + value } } |