cli - ignore std error unless verbose (#183787) (#184031)

This commit is contained in:
Benjamin Pasero 2023-06-01 10:32:33 +02:00 committed by GitHub
parent fbbcd0ea14
commit 66ad45b79a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -414,8 +414,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
options['stdio'] = ['ignore', 'pipe', 'ignore']; // restore ability to see output when --status is used
}
// We spawn process.execPath directly
child = spawn(process.execPath, argv.slice(2), options);
} else {
@ -440,7 +441,7 @@ export async function main(argv: string[]): Promise<any> {
// The open command only allows for redirecting stderr and stdout to files,
// so we make it redirect those to temp files, and then use a logger to
// redirect the file output to the console
for (const outputType of ['stdout', 'stderr']) {
for (const outputType of verbose ? ['stdout', 'stderr'] : ['stdout']) {
// Tmp file to target output to
const tmpName = randomPath(tmpdir(), `code-${outputType}`);