This commit is contained in:
Eugene Pankov 2019-01-05 14:51:36 +01:00
parent 9faa346699
commit 3aaf490f57
2 changed files with 6 additions and 1 deletions

View File

@ -264,7 +264,7 @@ export class Session extends BaseSession {
return null
}
try {
fs.access(this.guessedCWD)
await fs.access(this.guessedCWD)
} catch (e) {
return null
}

View File

@ -1,3 +1,4 @@
import * as fs from 'mz/fs'
import { Observable, AsyncSubject } from 'rxjs'
import { Injectable, Inject } from '@angular/core'
import { AppService, Logger, LogService, ConfigService } from 'terminus-core'
@ -41,6 +42,10 @@ export class TerminalService {
}
async openTab (shell?: IShell, cwd?: string, pause?: boolean): Promise<TerminalTabComponent> {
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()