Skip to content

Commit febf268

Browse files
committed
Ignore non-existent directories when listing split tunneling apps
1 parent 489e812 commit febf268

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gui/src/main/macos-split-tunneling.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,16 @@ export class MacOsSplitTunnelingAppListRetriever implements ISplitTunnelingAppLi
127127
* Returns contents of directory with results as absolute paths.
128128
*/
129129
private async readDirectory(applicationDir: string) {
130-
const basenames = await fs.readdir(applicationDir);
131-
return basenames.map((basename) => path.join(applicationDir, basename));
130+
try {
131+
const basenames = await fs.readdir(applicationDir);
132+
return basenames.map((basename) => path.join(applicationDir, basename));
133+
} catch (err) {
134+
const e = err as NodeJS.ErrnoException;
135+
if (e.code !== 'ENOENT' && e.code !== 'ENOTDIR') {
136+
log.error(`Failed to read directory contents: ${applicationDir}`, err);
137+
}
138+
return [];
139+
}
132140
}
133141

134142
private async readApplicationBundlePlist(applicationBundlePath: string): Promise<Plist> {

0 commit comments

Comments
 (0)