GP-6580: Suppressing "java -version" output

This commit is contained in:
Ryan Kurtz
2026-04-15 05:50:44 -04:00
parent 5f211c313f
commit 56d072f13b

View File

@@ -319,7 +319,7 @@ class PyGhidraLauncher:
# NOTE: shutils.which() is not enough...macOS puts a stub java on the PATH which
# will prevent that from working as expected, so you have to actually run it.
java_cmd = 'java'
if not shutil.which(java_cmd) or subprocess.run([java_cmd, "-version"]).returncode != 0:
if not shutil.which(java_cmd) or subprocess.run([java_cmd, "-version"], stderr=subprocess.DEVNULL).returncode != 0:
java_home_dir = os.environ.get('JAVA_HOME')
if java_home_dir and os.path.isdir(java_home_dir):
java_cmd = java_home_dir + "/bin/java"