mirror of
https://github.com/Eugeny/tabby.git
synced 2025-02-23 14:59:41 +08:00
Catch errors when trying to derive CWD in Linux, fixes #1576
When the process it tries to read the working dir from has exited, then "/proc/PID/cwd" is an invalid link and fs.readlink() will reject its promise with an error. This results in the terminal "new tab" and "new pane" buttons stopping working, which is very disruptive :( This commit makes sure that the "new tab" and "new pane" buttons keep working, whatever happens.
This commit is contained in:
parent
a186ae70c7
commit
d7c8bc9da0
@ -291,7 +291,12 @@ export class Session extends BaseSession {
|
||||
return cwd
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
return fs.readlink(`/proc/${this.truePID}/cwd`)
|
||||
try {
|
||||
return await fs.readlink(`/proc/${this.truePID}/cwd`)
|
||||
} catch (exc) {
|
||||
console.error(exc)
|
||||
return null
|
||||
}
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
if (!this.guessedCWD) {
|
||||
|
Loading…
Reference in New Issue
Block a user