src/vs/workbench/contrib/terminal/browser/terminalService.ts/TerminalService/safeDisposeTerminal
class TerminalService:	async safeDisposeTerminal(instance: ITerminalInstance): Promise<void> {
		// Confirm on kill in the editor is handled by the editor input
		if (instance.target !== TerminalLocation.Editor &&
			instance.hasChildProcesses &&
			(this.configHelper.config.confirmOnKill === 'panel' || this.configHelper.config.confirmOnKill === 'always')) {

			const veto = await this._showTerminalCloseConfirmation(true);
			if (veto) {
				return;
			}
		}
		return new Promise<void>(r => {
			instance.onExit(() => r());
			instance.dispose(TerminalExitReason.User);
		});
	}