Skip to content
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

Fixes #1345 - do not buffer logging for native-image output #1540

Merged
merged 1 commit into from
Apr 8, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
className,
classpathJars.map(_._1),
extraOptions,
streams.log
UnbufferedProcessLogger(streams.log)
)

case Some(image) =>
Expand Down Expand Up @@ -152,7 +152,7 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
s"-H:Name=$binaryName"
) ++ extraOptions ++ Seq(className)

sys.process.Process(command) ! streams.log match {
sys.process.Process(command) ! UnbufferedProcessLogger(streams.log) match {
case 0 => targetDirectory / binaryName
case x => sys.error(s"Failed to run $command, exit status: " + x)
}
Expand Down Expand Up @@ -218,3 +218,11 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
Stager.stage(GraalVMBaseImage)(streams, stageDir, mappings)
}
}

private case class UnbufferedProcessLogger(logger: Logger) extends ProcessLogger {
override def out(s: => String): Unit = logger.out(s)

override def err(s: => String): Unit = logger.err(s)

override def buffer[T](f: => T): T = f
}