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,7 +148,9 @@ 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
try {
disposable = (vscode.window as vscode.Window).onDidEndTerminalShellExecution?.(async (e) => {
// console.log(`Terminal shell execution ended. Command line:`, e.execution.commandLine.value) // console.log(`Terminal shell execution ended. Command line:`, e.execution.commandLine.value)
const stream = e?.execution?.read() const stream = e?.execution?.read()
if (stream) { if (stream) {
@@ -157,6 +159,9 @@ export class TerminalManager {
} }
} }
}) })
} catch (error) {
console.error("Error setting up onDidEndTerminalShellExecution", error)
}
if (disposable) { if (disposable) {
this.disposables.push(disposable) this.disposables.push(disposable)
} }