mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
This commit is contained in:
parent
96d0b8a91d
commit
78aa857202
1 changed files with 13 additions and 4 deletions
|
@ -116,10 +116,19 @@ export class WorkspaceHandler {
|
|||
public async listWorkspaceFolders(repoUri: string) {
|
||||
const workspaceDir = await this.workspaceDir(repoUri);
|
||||
const isDir = (source: string) => fs.lstatSync(source).isDirectory();
|
||||
return fs
|
||||
.readdirSync(workspaceDir)
|
||||
.map(name => path.join(workspaceDir, name))
|
||||
.filter(isDir);
|
||||
try {
|
||||
return fs
|
||||
.readdirSync(workspaceDir)
|
||||
.map(name => path.join(workspaceDir, name))
|
||||
.filter(isDir);
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
this.log.debug('Cannot find workspace dirs');
|
||||
return [];
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async clearWorkspace(repoUri: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue