From bdf3bf4d3e8ee989439b67bd2fbe73b4dc8e464b Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Tue, 6 Sep 2016 12:00:23 -0700 Subject: [PATCH] Handle undefined terminal name. Fix #11397 --- .../parts/terminal/electron-browser/terminalService.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts index 6de6cd2b0635a..11cdcefdaa033 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts @@ -187,6 +187,7 @@ export class TerminalService implements ITerminalService { // to be stored for when createNew is called from TerminalPanel.create. This has to work // like this as TerminalPanel.setVisible must create a terminal if there is none due to how // the TerminalPanel is restored on launch if it was open previously. + if (processCount === 0 && !name) { name = this.nextTerminalName; this.nextTerminalName = undefined; @@ -294,7 +295,7 @@ export class TerminalService implements ITerminalService { let locale = this.configHelper.isSetLocaleVariables() ? platform.locale : undefined; let env = TerminalService.createTerminalEnv(process.env, this.configHelper.getShell(), this.contextService.getWorkspace(), locale); let terminalProcess = { - title: name, + title: name ? name : '', process: cp.fork('./terminalProcess', [], { env: env, cwd: URI.parse(path.dirname(require.toUrl('./terminalProcess'))).fsPath @@ -308,7 +309,7 @@ export class TerminalService implements ITerminalService { // Only listen for process title changes when a name is not provided terminalProcess.process.on('message', (message) => { if (message.type === 'title') { - terminalProcess.title = message.content; + terminalProcess.title = message.content ? message.content : ''; this._onInstanceTitleChanged.fire(); } });