Fix the multi-platform check

This commit is contained in:
Brett Williams
2023-06-04 13:05:30 -05:00
parent a5d49abfae
commit 1f263c7124

View File

@@ -5,11 +5,11 @@ logger = logging.getLogger()
def launch_url(url):
if subprocess.check_output(['which', 'open']):
subprocess.run(['open', url]) # macos
elif subprocess.check_output(['which', 'xdg-open']):
if subprocess.run(['which', 'xdg-open'], capture_output=True).returncode == 0:
subprocess.run(['xdg-open', url]) # linux
elif subprocess.check_output(['which', 'start']):
elif subprocess.run(['which', 'open'], capture_output=True).returncode == 0:
subprocess.run(['open', url]) # macos
elif subprocess.run(['which', 'start'], capture_output=True).returncode == 0:
subprocess.run(['start', url]) # windows - need to validate this works
else:
logger.error(f"No valid launchers found to launch url: {url}")