1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-26 12:03:31 +03:00

fixed profile launching

This commit is contained in:
Eugene Pankov 2019-05-17 17:54:11 +02:00
parent 48ff7d7d5a
commit 26d7dc3031

View File

@ -63,15 +63,18 @@ export class TerminalService {
* @param pause Wait for a keypress when the shell exits * @param pause Wait for a keypress when the shell exits
*/ */
async openTab (profile?: Profile, cwd?: string, pause?: boolean): Promise<TerminalTabComponent> { async openTab (profile?: Profile, cwd?: string, pause?: boolean): Promise<TerminalTabComponent> {
cwd = cwd || profile.sessionOptions.cwd
if (cwd && !fs.existsSync(cwd)) {
console.warn('Ignoring non-existent CWD:', cwd)
cwd = null
}
if (!profile) { if (!profile) {
let profiles = await this.getProfiles() let profiles = await this.getProfiles()
profile = profiles.find(x => slug(x.name) === this.config.store.terminal.profile) || profiles[0] 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 (!cwd) {
if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) { if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) {
cwd = await this.app.activeTab.session.getWorkingDirectory() cwd = await this.app.activeTab.session.getWorkingDirectory()