cli: avoid interactions when running integrated (#167780)

Fixes https://github.com/microsoft/vscode/issues/167760

The VS Code CLI gets run from a bash/shell script. This prevents interactions--in the former case, it doesn't look like a tty, and in the latter case batch scripts don't seem to support having interactive subprocesses.

This PR avoids interactions if stdin is not a tty, prompting the user to use the flag instead. Use of the flag is also persisted like an interactive agreement prompt.
This commit is contained in:
Connor Peet
2022-11-30 15:15:08 -08:00
committed by GitHub
parent 968026a46d
commit c87fa19f79
4 changed files with 23 additions and 22 deletions

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
use crate::auth;
use crate::constants::{
CONTROL_PORT, PROTOCOL_VERSION_TAG, PROTOCOL_VERSION_TAG_PREFIX, TUNNEL_SERVICE_USER_AGENT,
CONTROL_PORT, PROTOCOL_VERSION_TAG, PROTOCOL_VERSION_TAG_PREFIX, TUNNEL_SERVICE_USER_AGENT, IS_INTERACTIVE_CLI,
};
use crate::state::{LauncherPaths, PersistedState};
use crate::util::errors::{
@@ -659,7 +659,7 @@ impl DevTunnels {
}
let mut placeholder_name = name_generator::generate_name(MAX_TUNNEL_NAME_LENGTH);
if use_random_name {
if use_random_name || !*IS_INTERACTIVE_CLI {
while !is_name_free(&placeholder_name) {
placeholder_name = name_generator::generate_name(MAX_TUNNEL_NAME_LENGTH);
}