From c93024e3674692fb3fd15782e5b6418b0c25bba9 Mon Sep 17 00:00:00 2001 From: dev747368 <48332326+dev747368@users.noreply.github.com> Date: Tue, 13 Jun 2023 16:30:44 +0000 Subject: [PATCH] GP-3542 Don't try to prompt user for JDK path when no tty present --- Ghidra/RuntimeScripts/Linux/support/launch.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Ghidra/RuntimeScripts/Linux/support/launch.sh b/Ghidra/RuntimeScripts/Linux/support/launch.sh index 97bb85470d..0b8b0874d7 100755 --- a/Ghidra/RuntimeScripts/Linux/support/launch.sh +++ b/Ghidra/RuntimeScripts/Linux/support/launch.sh @@ -135,6 +135,13 @@ fi # Get the JDK that will be used to launch Ghidra JAVA_HOME="$(java -cp "${LS_CPATH}" LaunchSupport "${INSTALL_DIR}" ${JAVA_TYPE_ARG} -save)" if [ ! $? -eq 0 ]; then + # If fd 0 (stdin) isn't a tty, fail because we can't prompt the user + if [ ! -t 0 ]; then + echo + echo "Unable to prompt user for JDK path, no TTY detected. Please refer to the Ghidra Installation Guide's Troubleshooting section." + exit 1 + fi + # No JDK has been setup yet. Let the user choose one. java -cp "${LS_CPATH}" LaunchSupport "${INSTALL_DIR}" ${JAVA_TYPE_ARG} -ask