Skip to content

Commit 5a4de19

Browse files
author
Kartik Raj
committed
Alternate
1 parent a863386 commit 5a4de19

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/client/common/variables/systemVariables.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,16 @@ export class SystemVariables extends AbstractSystemVariables {
127127
>)[`env.${key}`] = process.env[key];
128128
});
129129
workspace = workspace ?? new WorkspaceService();
130-
if (workspace.workspaceFolders && 'forEach' in workspace.workspaceFolders) {
131-
workspace.workspaceFolders.forEach(async (folder) => {
132-
const basename = Path.basename(folder.uri.fsPath);
133-
((this as any) as Record<string, string | undefined>)[`workspaceFolder:${basename}`] =
134-
folder.uri.fsPath;
135-
});
130+
if (workspace.workspaceFolders) {
131+
try {
132+
workspace.workspaceFolders.forEach((folder) => {
133+
const basename = Path.basename(folder.uri.fsPath);
134+
((this as any) as Record<string, string | undefined>)[`workspaceFolder:${basename}`] =
135+
folder.uri.fsPath;
136+
});
137+
} catch {
138+
// This try...catch block is here to support pre-existing tests, ignore error.
139+
}
136140
}
137141
}
138142

0 commit comments

Comments
 (0)