From c2b6c003b780552a2d3e4f42456c2bed11ac7230 Mon Sep 17 00:00:00 2001 From: Victor Rubezhny Date: Tue, 16 Apr 2024 20:29:35 +0200 Subject: [PATCH] Add proposal message to change stdout max buffer length preference... ...in case of 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER' error appearance Signed-off-by: Victor Rubezhny --- src/cli.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cli.ts b/src/cli.ts index 45bb2a2d9..0895abdc5 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -4,6 +4,7 @@ *-----------------------------------------------------------------------------------------------*/ import { VSCodeSettings } from '@redhat-developer/vscode-redhat-telemetry/lib/common/vscode/settings'; +import * as vscode from 'vscode'; import * as cp from 'child_process'; import { CommandText } from './base/command'; import { ToolsConfig } from './tools'; @@ -59,6 +60,14 @@ export class CliChannel { const optsCopy = CliChannel.applyEnv(opts, CliChannel.createTelemetryEnv()) const result: CliExitData = await ChildProcessUtil.Instance.execute(toolLocation ? commandActual.replace(cmd, `"${toolLocation}"`) : commandActual, optsCopy); if (result.error && fail) { + if (result.error.code && result.error.code.toString() === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER') { + void vscode.window.showErrorMessage('Do you want to change the maximum \'stdout\' buffer size by modifying the \'openshiftToolkit.execMaxBufferLength\' preference value?', 'Yes', 'Cancel') + .then((answer)=> { + if (answer === 'Yes') { + void vscode.commands.executeCommand('workbench.action.openSettings', 'openshiftToolkit.execMaxBufferLength'); + } + }); + } throw new VsCommandError(`${result.error.message}`, `Error when running command: ${commandPrivacy}`, result.error); }; return result;