Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/core/src/codewhispererChat/tools/executeBash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class ExecuteBash {
const stderrBuffer: string[] = []

let firstChunk = true
let firstStderrChunk = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this flag used for?

Copy link
Contributor

@tsmithsz tsmithsz Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's the first chunk we append this mark down string ('```console\n') before the text to format the code block appropriately

const childProcessOptions: ChildProcessOptions = {
spawnOptions: {
cwd: this.workingDirectory,
Expand All @@ -87,7 +88,8 @@ export class ExecuteBash {
firstChunk = false
},
onStderr: (chunk: string) => {
ExecuteBash.handleChunk(chunk, stderrBuffer, updates)
ExecuteBash.handleChunk(firstStderrChunk ? '```console\n' + chunk : chunk, stderrBuffer, updates)
firstStderrChunk = false
},
}

Expand Down
Loading