From 5e2bcf10b948f90f636fc20d8ff205ff70eb911d Mon Sep 17 00:00:00 2001 From: philwalk Date: Sun, 26 Jan 2025 11:15:16 -0700 Subject: [PATCH] fix for #22461 jar with empty ClassPath attribute --- .../dotc/classpath/ClassPathFactory.scala | 4 +++- dist/libexec/common-shared | 19 +++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala b/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala index 080f8d4e63d2..b69f4aa3fc1b 100644 --- a/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala +++ b/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala @@ -69,8 +69,10 @@ class ClassPathFactory { a <- ClassPath.expandManifestPath(file.absolutePath) path = java.nio.file.Paths.get(a.toURI()).nn if Files.exists(path) + entry = AbstractFile.getFile(path) + if Option(entry).nonEmpty yield - newClassPath(AbstractFile.getFile(path)) + newClassPath(entry) else Seq.empty diff --git a/dist/libexec/common-shared b/dist/libexec/common-shared index bcf5d52d95b7..fa1e62c09241 100644 --- a/dist/libexec/common-shared +++ b/dist/libexec/common-shared @@ -6,21 +6,16 @@ # * Credits: This script is based on the script generated by sbt-pack. # *--------------------------------------------------------------------------*/ -if [ -e /usr/bin/tty -a "`tty`" != "not a tty" -a ! -p /dev/stdin ]; then - isterminal=1 - # save terminal settings - saved_stty=$(stty -g 2>/dev/null) - # clear on error so we don't later try to restore them - if [[ ! $? ]]; then - saved_stty="" - fi -else - isterminal=0 +# save terminal settings +saved_stty=$(stty -g 2>/dev/null) +# clear on error so we don't later try to restore them +if [[ ! $? ]]; then + saved_stty="" fi # restore stty settings (echo in particular) function restoreSttySettings() { - [ $isterminal -eq 1 ] && stty $saved_stty + stty $saved_stty saved_stty="" } @@ -66,7 +61,7 @@ if [[ ${cygwin-} || ${mingw-} || ${msys-} ]]; then CYGPATHCMD=`which cygpath 2>/dev/null` case "$TERM" in rxvt* | xterm* | cygwin*) - [ $isterminal -eq 1 ] && stty -icanon min 1 -echo + stty -icanon min 1 -echo JAVA_OPTS="$JAVA_OPTS -Djline.terminal=unix" ;; esac