From 26d7dc3031e357dd213ca75e75528e64acbf3cd0 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Fri, 17 May 2019 17:54:11 +0200 Subject: [PATCH] fixed profile launching --- terminus-terminal/src/services/terminal.service.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/terminus-terminal/src/services/terminal.service.ts b/terminus-terminal/src/services/terminal.service.ts index 7e52b083..ab8d90d9 100644 --- a/terminus-terminal/src/services/terminal.service.ts +++ b/terminus-terminal/src/services/terminal.service.ts @@ -63,15 +63,18 @@ export class TerminalService { * @param pause Wait for a keypress when the shell exits */ async openTab (profile?: Profile, cwd?: string, pause?: boolean): Promise { - cwd = cwd || profile.sessionOptions.cwd - if (cwd && !fs.existsSync(cwd)) { - console.warn('Ignoring non-existent CWD:', cwd) - cwd = null - } if (!profile) { let profiles = await this.getProfiles() profile = profiles.find(x => slug(x.name) === this.config.store.terminal.profile) || profiles[0] } + + cwd = cwd || profile.sessionOptions.cwd + + if (cwd && !fs.existsSync(cwd)) { + console.warn('Ignoring non-existent CWD:', cwd) + cwd = null + } + if (!cwd) { if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) { cwd = await this.app.activeTab.session.getWorkingDirectory()