mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-16 09:29:59 +00:00
ignore non-existent CWDs (fixes #586)
This commit is contained in:
parent
d56287587c
commit
7a26e8bd65
@ -104,16 +104,24 @@ export class Session extends BaseSession {
|
|||||||
LC_MONETARY: locale,
|
LC_MONETARY: locale,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let cwd = options.cwd || process.env.HOME
|
||||||
|
|
||||||
|
if (!fs.existsSync(cwd)) {
|
||||||
|
console.warn('Ignoring non-existent CWD:', cwd)
|
||||||
|
cwd = null
|
||||||
|
}
|
||||||
|
|
||||||
this.pty = nodePTY.spawn(options.command, options.args || [], {
|
this.pty = nodePTY.spawn(options.command, options.args || [], {
|
||||||
name: 'xterm-256color',
|
name: 'xterm-256color',
|
||||||
cols: options.width || 80,
|
cols: options.width || 80,
|
||||||
rows: options.height || 30,
|
rows: options.height || 30,
|
||||||
cwd: options.cwd || process.env.HOME,
|
cwd,
|
||||||
env: env,
|
env: env,
|
||||||
experimentalUseConpty: this.config.store.terminal.useConPTY,
|
experimentalUseConpty: this.config.store.terminal.useConPTY,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.guessedCWD = options.cwd || process.env.HOME
|
this.guessedCWD = cwd
|
||||||
|
|
||||||
this.truePID = (this.pty as any).pid
|
this.truePID = (this.pty as any).pid
|
||||||
|
|
||||||
@ -252,6 +260,14 @@ export class Session extends BaseSession {
|
|||||||
return fs.readlink(`/proc/${this.truePID}/cwd`)
|
return fs.readlink(`/proc/${this.truePID}/cwd`)
|
||||||
}
|
}
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
if (!this.guessedCWD) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
fs.access(this.guessedCWD)
|
||||||
|
} catch (e) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
return this.guessedCWD
|
return this.guessedCWD
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user