Skip to content

Commit 49bd9cd

Browse files
committed
Show the logs in the chatwindow
1 parent b136dbe commit 49bd9cd

File tree

1 file changed

+14
-2
lines changed
  • packages/core/src/codewhispererChat/controllers/chat

1 file changed

+14
-2
lines changed

packages/core/src/codewhispererChat/controllers/chat/controller.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,20 @@ export class ChatController {
588588
// Execute the command in terminal
589589
terminal.sendText(command)
590590

591-
// Store the outLogFilePath text in lastTerminalOutput
592-
this.lastTerminalOutput = outLogFilePath
591+
// Read the content from outLogFilePath and store it in lastTerminalOutput
592+
try {
593+
// Wait a moment for the command to complete and write to the file
594+
await new Promise((resolve) => setTimeout(resolve, 500))
595+
596+
if (await fs.existsFile(outLogFilePath)) {
597+
this.lastTerminalOutput = await fs.readFileText(outLogFilePath)
598+
} else {
599+
this.lastTerminalOutput = 'Command executed, but no output was captured.'
600+
}
601+
} catch (readErr) {
602+
getLogger().error(`Failed to read output log file: ${readErr}`)
603+
this.lastTerminalOutput = `Error reading command output: ${readErr}`
604+
}
593605

594606
getLogger().info(`Command executed: ${command}`)
595607
getLogger().info(`Output saved to: ${outLogFilePath}`)

0 commit comments

Comments
 (0)