code --status displays a lot of errors before actual status output (fix #183787) (#183915)

This commit is contained in:
Benjamin Pasero 2023-05-31 11:47:24 +02:00 committed by GitHub
parent 2d131d25d1
commit 2a8dea3225
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -382,7 +382,7 @@ class CodeMain {
// Print --status usage info
if (environmentMainService.args.status) {
logService.warn('Warning: The --status argument can only be used if {0} is already running. Please run it again after {0} has started.', productService.nameShort);
logService.warn(localize('statusWarning', "Warning: The --status argument can only be used if {0} is already running. Please run it again after {0} has started.", productService.nameShort));
throw new ExpectedError('Terminating...');
}

View file

@ -188,7 +188,7 @@ export async function main(argv: string[]): Promise<any> {
const processCallbacks: ((child: ChildProcess) => Promise<void>)[] = [];
const verbose = args.verbose || args.status;
const verbose = args.verbose;
if (verbose) {
env['ELECTRON_ENABLE_LOGGING'] = '1';
@ -413,6 +413,9 @@ export async function main(argv: string[]): Promise<any> {
let child: ChildProcess;
if (!isMacOSBigSurOrNewer) {
if (!verbose && args.status) {
options['stdio'] = 'pipe'; // restore ability to see output when --status is used
}
// We spawn process.execPath directly
child = spawn(process.execPath, argv.slice(2), options);
} else {
@ -431,7 +434,7 @@ export async function main(argv: string[]): Promise<any> {
// -a opens the given application.
spawnArgs.push('-a', process.execPath); // -a: opens a specific application
if (verbose) {
if (verbose || args.status) {
spawnArgs.push('--wait-apps'); // `open --wait-apps`: blocks until the launched app is closed (even if they were already running)
// The open command only allows for redirecting stderr and stdout to files,