-
Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insiderson-release-notesIssue/pull request mentioned in release notesIssue/pull request mentioned in release noteson-testplanterminalGeneral terminal issues that don't fall under another labelGeneral terminal issues that don't fall under another labelwindowsVS Code on Windows issuesVS Code on Windows issues
Milestone
Description
When you hit ^C
during batch scripts they will ask this "Terminate batch job (Y/N)?" question which is super annoying and often the process that the batch script was running has already been killed anyway.
Clink works around this by allowing configuring to auto answer the question and it's really nice. I put together a little prototype and it feels great:
The above was done by translating the terminal line to a string whenever process data comes in and checking if it contains that text. We would want to look into faster alternatives to that and to also ensure we don't answer twice for the same line (just in case):
private _onProcessData(ev: IProcessDataEvent): void {
const messageId = ++this._latestXtermWriteData;
if (ev.trackCommit) {
ev.writePromise = new Promise<void>(r => {
this._xterm?.write(ev.data, () => {
this._latestXtermParseData = messageId;
this._processManager.acknowledgeDataEvent(ev.data.length);
const line = this._xterm?.buffer.active.getLine(this._xterm.buffer.active.baseY + this._xterm.buffer.active.cursorY)?.translateToString(true);
if (line && line.indexOf('Terminate batch job (Y/N)') >= 0) {
this._processManager.write('Y\r').then(() => {
this._onDidInputData.fire(this);
});
}
r();
});
});
} else {
this._xterm?.write(ev.data, () => {
this._latestXtermParseData = messageId;
this._processManager.acknowledgeDataEvent(ev.data.length);
const line = this._xterm?.buffer.active.getLine(this._xterm.buffer.active.baseY + this._xterm.buffer.active.cursorY)?.translateToString(true);
if (line && line.indexOf('Terminate batch job (Y/N)') >= 0) {
this._processManager.write('Y\r').then(() => {
this._onDidInputData.fire(this);
});
}
});
}
}
yume-chan
Metadata
Metadata
Assignees
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insiderson-release-notesIssue/pull request mentioned in release notesIssue/pull request mentioned in release noteson-testplanterminalGeneral terminal issues that don't fall under another labelGeneral terminal issues that don't fall under another labelwindowsVS Code on Windows issuesVS Code on Windows issues