6
如何從與#& &等組合的外部過程中捕獲異常。過程組成和例外
scala> import scala.sys.process._
scala> try{ "throw " ! }catch{ case e: Exception => }
res1: AnyVal =()
scala> try{ "throw " #&& "ls" ! }catch{ case e: Exception => }
Exception in thread "Thread-10" java.io.IOException: Cannot run program "throw": error=2, No such file or directory
確實,我的程序沒有崩潰。它只是在正常程序運行期間發生std錯誤的堆棧跟蹤,而不僅僅是REPL。這讓我很困惑。 –