Class

os

proc

Related Doc: package os

Permalink

case class proc(command: Shellable*) extends Product with Serializable

Convenience APIs around java.lang.Process and java.lang.ProcessBuilder:

- os.proc.call provides a convenient wrapper for "function-like" processes that you invoke with some input, whose entire output you need, but otherwise do not have any intricate back-and-forth communication

- os.proc.stream provides a lower level API: rather than providing the output all at once, you pass in callbacks it invokes whenever there is a chunk of output received from the spawned process.

- os.proc(...) provides the lowest level API: an simple Scala API around java.lang.ProcessBuilder, that spawns a normal java.lang.Process for you to deal with. You can then interact with it normally through the standard stdin/stdout/stderr streams, using whatever protocol you want

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. proc
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new proc(command: Shellable*)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def call(cwd: Path = null, env: Map[String, String] = null, data: Source = Array[Byte](), stdin: Redirect = Pipe, stdout: Redirect = Pipe, stderr: Redirect = Pipe, mergeErrIntoOut: Boolean = false, timeout: Long = Long.MaxValue, check: Boolean = false, propagateEnv: Boolean = true): CommandResult

    Permalink

    Invokes the given subprocess like a function, passing in input and returning a CommandResult.

    Invokes the given subprocess like a function, passing in input and returning a CommandResult. You can then call result.exitCode to see how it exited, or result.out.bytes or result.err.string to access the aggregated stdout and stderr of the subprocess in a number of convenient ways.

    If you want to spawn an interactive subprocess, such as vim, less, or a python shell, set all of stdin/stdout/stderr to os.Inherit

    call provides a number of parameters that let you configure how the subprocess is run:

    cwd

    the working directory of the subprocess

    env

    any additional environment variables you wish to set in the subprocess

    stdin

    any data you wish to pass to the subprocess's standard input

    stdout

    os.Redirect that lets you configure how the process's output stream is configured.

    stderr

    os.Redirect that lets you configure how the process's error stream is configured.

    mergeErrIntoOut

    merges the subprocess's stderr stream into it's stdout

    timeout

    how long to wait for the subprocess to complete

    check

    enable this to throw an exception if the subprocess fails with a non-zero exit code

    propagateEnv

    disable this to avoid passing in this parent process's environment variables to the subprocess

  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. val command: Shellable*

    Permalink
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. def spawn(cwd: Path = null, env: Map[String, String] = null, stdin: Redirect = Pipe, stdout: Redirect = Pipe, stderr: Redirect = Pipe, mergeErrIntoOut: Boolean = false, propagateEnv: Boolean = true): Process

    Permalink

    The most flexible of the os.proc calls, os.proc.spawn simply configures and starts a subprocess, and returns it as a java.lang.Process for you to interact with however you like.

  16. def stream(cwd: Path = null, env: Map[String, String] = null, data: Source = Array[Byte](), onOut: (Array[Byte], Int) ⇒ Unit, onErr: (Array[Byte], Int) ⇒ Unit, stdin: Redirect = Pipe, stdout: Redirect = Pipe, stderr: Redirect = Pipe, mergeErrIntoOut: Boolean = false, timeout: Long = Long.MaxValue, propagateEnv: Boolean = true): Int

    Permalink

    Similar to os.proc.call, but instead of aggregating the process's standard output/error streams for you, you pass in onOut/onErr callbacks to receive the data as it is generated.

    Similar to os.proc.call, but instead of aggregating the process's standard output/error streams for you, you pass in onOut/onErr callbacks to receive the data as it is generated.

    Returns the exit code of the subprocess once it terminates

  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  18. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped