Fix using shell API failing

This commit is contained in:
Saoud Rizwan
2024-09-17 11:59:20 -04:00
parent a38d20ec37
commit e3555c2729

View File

@@ -148,15 +148,20 @@ export class TerminalManager {
constructor() { constructor() {
// Listening to this reduces the # of empty terminal outputs! // Listening to this reduces the # of empty terminal outputs!
const disposable = (vscode.window as vscode.Window).onDidEndTerminalShellExecution?.(async (e) => { let disposable: vscode.Disposable | undefined
// console.log(`Terminal shell execution ended. Command line:`, e.execution.commandLine.value) try {
const stream = e?.execution?.read() disposable = (vscode.window as vscode.Window).onDidEndTerminalShellExecution?.(async (e) => {
if (stream) { // console.log(`Terminal shell execution ended. Command line:`, e.execution.commandLine.value)
for await (let _ of stream) { const stream = e?.execution?.read()
// console.log(`from onDidEndTerminalShellExecution, read:`, data) if (stream) {
for await (let _ of stream) {
// console.log(`from onDidEndTerminalShellExecution, read:`, data)
}
} }
} })
}) } catch (error) {
console.error("Error setting up onDidEndTerminalShellExecution", error)
}
if (disposable) { if (disposable) {
this.disposables.push(disposable) this.disposables.push(disposable)
} }