Skip to content

fix for #11536 and other terminal and shell environment issues #11539

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

Merged
merged 5 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/scripting/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ object Main:
val javaClasspath = sys.props("java.class.path")
val runtimeClasspath = s"${classpath}$pathsep$javaClasspath"

val jarTargetDir: Path = Option(scriptFile.toPath.getParent) match {
val jarTargetDir: Path = Option(scriptFile.toPath.toAbsolutePath.getParent) match {
case None => sys.error(s"no parent directory for script file [$scriptFile]")
case Some(parent) => parent
}
Expand Down
18 changes: 9 additions & 9 deletions dist/bin/common
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ function onExit() {
}

# to reenable echo if we are interrupted before completing.
trap onExit INT TERM
trap onExit INT TERM EXIT

cygwin=false
mingw=false
msys=false
darwin=false
unset cygwin mingw msys darwin conemu
case "`uname`" in
CYGWIN*) cygwin=true
;;
Expand All @@ -51,7 +48,9 @@ case "`uname`" in
esac

unset CYGPATHCMD
if [[ ($cygwin||$mingw||$msys) ]]; then
if [[ $cygwin || $mingw || $msys ]]; then
# ConEmu terminal is incompatible with jna-5.*.jar
[[ ($CONEMUANSI || $ConEmuANSI) ]] && conemu=true
# cygpath is used by various windows shells: cygwin, git-sdk, gitbash, msys, etc.
CYGPATHCMD=`which cygpath 2>/dev/null`
case "$TERM" in
Expand Down Expand Up @@ -113,7 +112,7 @@ if [ -n "$CYGPATHCMD" ]; then
JAVA_HOME=`"$CYGPATHCMD" -am "$JAVA_HOME"`
CLASSPATH_SUFFIX=";"
PSEP=";"
elif ($mingw || $msys); then
elif [[ $mingw || $msys ]]; then
# For Mingw / Msys, convert paths from UNIX format before anything is touched
[ -n "$PROG_HOME" ] &&
PROG_HOME="`(cd "$PROG_HOME"; pwd -W | sed 's|/|\\\\|g')`"
Expand All @@ -131,7 +130,7 @@ find_lib () {
local lib=$(find $PROG_HOME/lib/ -name "$1")
if [ -n "$CYGPATHCMD" ]; then
$CYGPATHCMD -am $lib
elif ($mingw || $msys); then
elif [[ $mingw || $msys ]]; then
echo $lib | sed 's|/|\\\\|g'
else
echo $lib
Expand All @@ -150,7 +149,8 @@ SBT_INTF=$(find_lib "*compiler-interface*")
JLINE_READER=$(find_lib "*jline-reader-3*")
JLINE_TERMINAL=$(find_lib "*jline-terminal-3*")
JLINE_TERMINAL_JNA=$(find_lib "*jline-terminal-jna-3*")
[[ ($mingw||$msys) ]] || JNA=$(find_lib "*jna-5*")
[[ $conemu ]] || JNA=$(find_lib "*jna-5*")

# debug

DEBUG_STR=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
5 changes: 3 additions & 2 deletions dist/bin/scalac
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ if [ "$PROG_NAME" == "$ScriptingMain" ]; then
scripting_string="-script $target_script ${scripting_args[@]}"
fi

eval exec "\"$JAVACMD\"" \
eval "\"$JAVACMD\"" \
${JAVA_OPTS:-$default_java_opts} \
"${DEBUG-}" \
"${java_args[@]}" \
Expand All @@ -130,4 +130,5 @@ eval exec "\"$JAVACMD\"" \
"${scala_args[@]}" \
"${residual_args[@]}" \
"${scripting_string-}"
exit $?
scala_exit_status=$?
onExit
5 changes: 3 additions & 2 deletions dist/bin/scaladoc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ done

classpathArgs

eval exec "\"$JAVACMD\"" \
eval "\"$JAVACMD\"" \
${JAVA_OPTS:-$default_java_opts} \
"$DEBUG" \
"${java_args[@]}" \
Expand All @@ -134,4 +134,5 @@ eval exec "\"$JAVACMD\"" \
"${scala_args[@]}" \
"${residual_args[@]}" \
"$scripting_string"
exit $?
scala_exit_status=$?
onExit