Skip to content

Commit

Permalink
chore: bring back which retry since it env is not immediately availab…
Browse files Browse the repository at this point in the history
…le (#286)
  • Loading branch information
pavelfeldman authored Dec 23, 2022
1 parent f822745 commit 9d5e2d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Playwright Test for VSCode",
"description": "Run Playwright Test tests in Visual Studio Code.",
"icon": "images/playwright-logo.png",
"version": "1.0.2",
"version": "1.0.3",
"publisher": "ms-playwright",
"repository": "https://github.com/microsoft/playwright-vscode",
"bugs": {
Expand Down
9 changes: 7 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function createGuid(): string {
export function ansiToHtml(text: string): string {
let isOpen = false;
let hasTags = false;
const tokens = [];
const tokens: string[] = [];
for (let i = 0; i < text.length; ++i) {
const c = text.charAt(i);
if (c === '\u001b') {
Expand Down Expand Up @@ -142,7 +142,12 @@ export async function findNode(): Promise<string> {
if (pathToNodeJS)
return pathToNodeJS;

const node = await which('node');
let node = await which('node');
// When extension host boots, it does not have the right env set, so we might need to wait.
for (let i = 0; i < 5 && !node; ++i) {
await new Promise(f => setTimeout(f, 1000));
node = await which('node');
}
if (!node)
throw new Error('Unable to launch `node`, make sure it is in your PATH');
pathToNodeJS = node;
Expand Down

0 comments on commit 9d5e2d5

Please sign in to comment.