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
+5 -8
View File
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ChildProcess, spawn, SpawnOptions } from 'child_process';
import { ChildProcess, ChildProcessWithoutNullStreams, spawn, SpawnOptions } from 'child_process';
import { chmodSync, existsSync, readFileSync, statSync, truncateSync, unlinkSync } from 'fs';
import { homedir, release, tmpdir } from 'os';
import type { ProfilingSession, Target } from 'v8-inspect-profiler';
@@ -55,7 +55,7 @@ export async function main(argv: string[]): Promise<any> {
return;
}
return new Promise((resolve, reject) => {
let tunnelProcess;
let tunnelProcess: ChildProcessWithoutNullStreams;
if (process.env['VSCODE_DEV']) {
tunnelProcess = spawn('cargo', ['run', '--', 'tunnel', ...argv.slice(5)], { cwd: join(getAppRoot(), 'cli') });
} else {
@@ -67,12 +67,9 @@ export async function main(argv: string[]): Promise<any> {
const tunnelArgs = argv.slice(3);
tunnelProcess = spawn(tunnelCommand, ['tunnel', ...tunnelArgs]);
}
tunnelProcess.stdout.on('data', data => {
console.log(data.toString());
});
tunnelProcess.stderr.on('data', data => {
console.error(data.toString());
});
tunnelProcess.stdout.pipe(process.stdout);
tunnelProcess.stderr.pipe(process.stderr);
tunnelProcess.on('exit', resolve);
tunnelProcess.on('error', reject);
});