Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search asdf directories for scarb executable #3665

Merged
merged 2 commits into from
Jul 25, 2023
Merged

Search asdf directories for scarb executable #3665

merged 2 commits into from
Jul 25, 2023

Conversation

szymmis
Copy link
Contributor

@szymmis szymmis commented Jul 12, 2023

Sometimes due to specific setup (like having custom ASDF_DATA_DIR variable) asdf scarb shim might not available through PATH variable. To solve this problem we can look for the executable in asdf directories as a fallback. Concept based on what intellij does when looking for java.

Worth noting that asdf is not supported on Windows machines outside WSL so when win32 platform is detected we just return undefined.


This change is Reviewable

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @spapinistarkware and @szymmis)


vscode-cairo/src/extension.ts line 111 at r1 (raw file):

  if (os.platform() === "win32") return undefined;

  const asdfDataDir = process.env.ASDF_DATA_DIR ?? `${process.env.HOME}/.asdf`;
  • I think I'd bail out (return undefined from this function) if HOME is empty

Suggestion:

path.join(process.env.HOME, ".asdf")

vscode-cairo/src/extension.ts line 117 at r1 (raw file):

    .access(scarbExecutablePath, fs.constants.X_OK)
    .then(() => scarbExecutablePath)
    .catch(() => undefined);

Nit

Suggestion:

  try {
    return await fs.promises.access(scarbExecutablePath, fs.constants.X_OK);
  } catch _e {
    return undefined;
  }

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)

Copy link
Collaborator

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @szymmis)

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @szymmis)

@orizi orizi added this pull request to the merge queue Jul 25, 2023
Merged via the queue into starkware-libs:main with commit f67f0b0 Jul 25, 2023
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants