gpt4 book ai didi

bash - 带有 Scala 2.12.12 的 Shell 脚本损坏了?

转载 作者:行者123 更新时间:2023-12-04 09:17:45 25 4
gpt4 key购买 nike

我有一些在 Scala 2.12.11 上运行的 shell 脚本。更新到 Scala 2.12.12 后,他们不再这样做了。
例子:

#!/bin/bash
echo "in Bash"
exec scala "$0" "$@"
!#
object Example { def main(args: Array[String]) = println("in Scala") }
Scala 2.12.11 的结果:
in Bash
in Scala
Scala 2.12.12 的结果:
in Bash
fscbad option: '-Ytrack-dependencies'
fsc -help gives more information
error: IO error while decoding /home/marcus/-Ytrack-dependencies with UTF-8: /home/marcus/-Ytrack-dependencies (No such file or directory)
Please try specifying another one using the -encoding option
error: IO error while decoding /home/marcus/-Xscript with UTF-8: /home/marcus/-Xscript (No such file or directory)
Please try specifying another one using the -encoding option
error: IO error while decoding /home/marcus/Main with UTF-8: /home/marcus/Main (No such file or directory)
Please try specifying another one using the -encoding option
three errors found
任何的想法?

最佳答案

卸载 Scala 不会停止编译器守护进程。因此,更新后正在运行的守护进程不再与 Scala 版本匹配。使用 fsc -shutdown 停止旧守护进程(一次)解决了这个问题。
或者,您可以通过添加 -nocompdaemon 来完全避免守护进程。到 scala称呼。从 Scala 2.13.0 开始,这是默认完成的(根据 issue 12102 )。

#!/bin/bash
echo "in Bash"
exec scala -nocompdaemon "$0" "$@"
!#
object Example { def main(args: Array[String]) = println("in Scala") }

关于bash - 带有 Scala 2.12.12 的 Shell 脚本损坏了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63154499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com