Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.sys/scala.sys.process/ProcessLogger

ProcessLogger

scala.sys.process.ProcessLogger
See theProcessLogger companion object

Encapsulates the output and error streams of a running process. This is used byscala.sys.process.ProcessBuilder when starting a process, as an alternative toscala.sys.process.ProcessIO, which can be more difficult to use. Note that aProcessLogger will be used to create aProcessIO anyway. The objectBasicIO has some functions to do that.

Here is an example that counts the number of lines in the normal and error output of a process:

import scala.sys.process._var normalLines = 0var errorLines = 0val countLogger = ProcessLogger(line => normalLines += 1,                               line => errorLines += 1)"find /etc" ! countLogger

Attributes

See also
Companion
object
Source
ProcessLogger.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Known subtypes

Members list

Value members

Abstract methods

defbuffer[T](f:=>T):T

If a process is begun with one of theseProcessBuilder methods:

If a process is begun with one of theseProcessBuilder methods:

def !(log: ProcessLogger): Intdef !<(log: ProcessLogger): Int

The run will be wrapped in a call to buffer. This gives the logger an opportunity to set up and tear down buffering. At present the library implementations ofProcessLogger simply execute the body unbuffered.

Attributes

Source
ProcessLogger.scala
deferr(s:=>String):Unit

Will be called with each line read from the process error stream.

Will be called with each line read from the process error stream.

Attributes

Source
ProcessLogger.scala
defout(s:=>String):Unit

Will be called with each line read from the process output stream.

Will be called with each line read from the process output stream.

Attributes

Source
ProcessLogger.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp