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

Update ExternalJavaProvider.available method to support Windows systems #31242

Open
eug opened this issue May 10, 2024 · 0 comments
Open

Update ExternalJavaProvider.available method to support Windows systems #31242

eug opened this issue May 10, 2024 · 0 comments

Comments

@eug
Copy link

eug commented May 10, 2024

The current implementation of the ExternalJavaProvider.available method only supports Unix/Linux systems. This issue aims to update the function to also support Windows systems.

Changes:

The available method will be updated to use the where command on Windows systems, instead of the which command used on Unix/Linux systems.

New implementation:

class ExternalJavaProvider(ExternalProvider):
  def __init__(self, urns, jar_provider):
    super().__init__(
        urns, lambda: external.JavaJarExpansionService(jar_provider()))
    self._jar_provider = jar_provider

  def available(self):
      cmd = 'where' if sys.platform == 'win32' else 'which'
      return subprocess.run([cmd, 'java'], capture_output=True).returncode == 0
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

No branches or pull requests

1 participant