mirror of https://github.com/sbt/sbt.git
Use NIO to create temp file
This commit is contained in:
parent
5b90e77ffa
commit
7780e0c676
|
|
@ -10,7 +10,8 @@ package sbt.internal.util
|
|||
import org.scalatest.flatspec.AnyFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
import sbt.util._
|
||||
import java.io.{ File, PrintWriter }
|
||||
import java.io.PrintWriter
|
||||
import java.nio.file.Files
|
||||
import sbt.io.Using
|
||||
import scala.annotation.nowarn
|
||||
|
||||
|
|
@ -141,7 +142,7 @@ class ManagedLoggerSpec extends AnyFlatSpec with Matchers {
|
|||
val console = ConsoleOut.systemOut
|
||||
def initialGlobalLogging: GlobalLogging = GlobalLogging.initial(
|
||||
MainAppender.globalDefault(console),
|
||||
File.createTempFile("sbt", ".log"),
|
||||
Files.createTempFile("sbt", ".log").toFile(),
|
||||
console
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ object StandardMain {
|
|||
private[this] def initialGlobalLogging(file: Option[File]): GlobalLogging = {
|
||||
def createTemp(attempt: Int = 0): File = Retry {
|
||||
file.foreach(f => if (!f.exists()) IO.createDirectory(f))
|
||||
File.createTempFile("sbt-global-log", ".log", file.orNull)
|
||||
Files.createTempFile(file.map(_.toPath()).orNull, "sbt-global-log", ".log").toFile
|
||||
}
|
||||
GlobalLogging.initial(
|
||||
MainAppender.globalDefault(ConsoleOut.globalProxy),
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ package sbt
|
|||
|
||||
import java.io.File
|
||||
import java.io.PrintWriter
|
||||
import java.nio.file.Files
|
||||
import java.lang.ProcessBuilder.Redirect
|
||||
import scala.sys.process.Process
|
||||
import OutputStrategy._
|
||||
|
|
@ -170,7 +171,7 @@ object Fork {
|
|||
* @return
|
||||
*/
|
||||
private def createArgumentsFile(options: Seq[String]): String = {
|
||||
val file = File.createTempFile(s"sbt-args", ".tmp")
|
||||
val file = Files.createTempFile(s"sbt-args", ".tmp").toFile()
|
||||
file.deleteOnExit()
|
||||
|
||||
val pw = new PrintWriter(file)
|
||||
|
|
|
|||
Loading…
Reference in New Issue