Set busy flag on ExecaTerminal so it reports in env details when backgrounded (#3031)

* Set busy flag on ExecaTerminal so it reports in env details when backgrounded

* Revert this
This commit is contained in:
Chris Estreich 2025-04-29 08:55:52 -07:00 committed by GitHub
parent d07e60575b
commit 8df1ee0252
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 8 deletions

View file

@ -2053,15 +2053,15 @@ export class Cline extends EventEmitter<ClineEvents> {
...TerminalRegistry.getBackgroundTerminals(false),
]
if (busyTerminals.length > 0 && this.didEditFile) {
await delay(300) // delay after saving file to let terminals catch up
}
if (busyTerminals.length > 0) {
if (this.didEditFile) {
await delay(300) // Delay after saving file to let terminals catch up.
}
// Wait for terminals to cool down.
await pWaitFor(() => busyTerminals.every((t) => !TerminalRegistry.isProcessHot(t.id)), {
interval: 100,
timeout: 15_000,
timeout: 5_000,
}).catch(() => {})
}

View file

@ -16,6 +16,8 @@ export class ExecaTerminal extends BaseTerminal {
}
public override runCommand(command: string, callbacks: RooTerminalCallbacks): RooTerminalProcessResultPromise {
this.busy = true
const process = new ExecaTerminalProcess(this)
process.command = command
this.process = process

View file

@ -11,6 +11,10 @@ export class ExecaTerminalProcess extends BaseTerminalProcess {
super()
this.terminalRef = new WeakRef(terminal)
this.once("completed", () => {
this.terminal.busy = false
})
}
public get terminal(): RooTerminal {

View file

@ -41,9 +41,9 @@ export class Terminal extends BaseTerminal {
}
public override runCommand(command: string, callbacks: RooTerminalCallbacks): RooTerminalProcessResultPromise {
// We set busy before the command is running because the terminal may be waiting
// on terminal integration, and we must prevent another instance from selecting
// the terminal for use during that time.
// We set busy before the command is running because the terminal may be
// waiting on terminal integration, and we must prevent another instance
// from selecting the terminal for use during that time.
this.busy = true
const process = new TerminalProcess(this)