summaryrefslogtreecommitdiff
path: root/src/library/scala/sys/process/Process.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-12 21:44:18 +0000
committerPaul Phillips <paulp@improving.org>2011-01-12 21:44:18 +0000
commit8f444e66269e6498080f4cf03f0989a3bc242c2a (patch)
treefa292752544435167d40c16f1cd184934c3d2227 /src/library/scala/sys/process/Process.scala
parentb4ba25da7ea3ed8f7f6ab23af241f025d4e9ea27 (diff)
downloadscala-8f444e66269e6498080f4cf03f0989a3bc242c2a.tar.gz
scala-8f444e66269e6498080f4cf03f0989a3bc242c2a.tar.bz2
scala-8f444e66269e6498080f4cf03f0989a3bc242c2a.zip
Purely detabification of the process code.
Diffstat (limited to 'src/library/scala/sys/process/Process.scala')
-rw-r--r--src/library/scala/sys/process/Process.scala98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/library/scala/sys/process/Process.scala b/src/library/scala/sys/process/Process.scala
index c64bb95fcf..c6a1f0d23f 100644
--- a/src/library/scala/sys/process/Process.scala
+++ b/src/library/scala/sys/process/Process.scala
@@ -16,70 +16,70 @@ import ProcessBuilder._
* It may be a compound process with several underlying native processes (such as 'a #&& b`).
*/
trait Process {
- /** Blocks until this process exits and returns the exit code.*/
- def exitValue(): Int
- /** Destroys this process. */
- def destroy(): Unit
+ /** Blocks until this process exits and returns the exit code.*/
+ def exitValue(): Int
+ /** Destroys this process. */
+ def destroy(): Unit
}
/** Methods for constructing simple commands that can then be combined. */
object Process extends ProcessImpl with ProcessCreation { }
trait ProcessCreation {
- def apply(command: String): ProcessBuilder = apply(command, None)
- def apply(command: Seq[String]): ProcessBuilder = apply(command, None)
- def apply(command: String, arguments: Seq[String]): ProcessBuilder = apply(command +: arguments, None)
+ def apply(command: String): ProcessBuilder = apply(command, None)
+ def apply(command: Seq[String]): ProcessBuilder = apply(command, None)
+ def apply(command: String, arguments: Seq[String]): ProcessBuilder = apply(command +: arguments, None)
- /** create ProcessBuilder with working dir set to File and extra environment variables */
- def apply(command: String, cwd: File, extraEnv: (String, String)*): ProcessBuilder =
- apply(command, Some(cwd), extraEnv: _*)
+ /** create ProcessBuilder with working dir set to File and extra environment variables */
+ def apply(command: String, cwd: File, extraEnv: (String, String)*): ProcessBuilder =
+ apply(command, Some(cwd), extraEnv: _*)
- /** create ProcessBuilder with working dir set to File and extra environment variables */
- def apply(command: Seq[String], cwd: File, extraEnv: (String, String)*): ProcessBuilder =
- apply(command, Some(cwd), extraEnv: _*)
+ /** create ProcessBuilder with working dir set to File and extra environment variables */
+ def apply(command: Seq[String], cwd: File, extraEnv: (String, String)*): ProcessBuilder =
+ apply(command, Some(cwd), extraEnv: _*)
- /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */
- def apply(command: String, cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = {
- apply(command.split("""\s+"""), cwd, extraEnv : _*)
- // not smart to use this on windows, because CommandParser uses \ to escape ".
- /*CommandParser.parse(command) match {
- case Left(errorMsg) => error(errorMsg)
- case Right((cmd, args)) => apply(cmd :: args, cwd, extraEnv : _*)
- }*/
- }
+ /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */
+ def apply(command: String, cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = {
+ apply(command.split("""\s+"""), cwd, extraEnv : _*)
+ // not smart to use this on windows, because CommandParser uses \ to escape ".
+ /*CommandParser.parse(command) match {
+ case Left(errorMsg) => error(errorMsg)
+ case Right((cmd, args)) => apply(cmd :: args, cwd, extraEnv : _*)
+ }*/
+ }
- /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */
- def apply(command: Seq[String], cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = {
- val jpb = new JProcessBuilder(command.toArray: _*)
- cwd foreach (jpb directory _)
- extraEnv foreach { case (k, v) => jpb.environment.put(k, v) }
- apply(jpb)
- }
+ /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */
+ def apply(command: Seq[String], cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = {
+ val jpb = new JProcessBuilder(command.toArray: _*)
+ cwd foreach (jpb directory _)
+ extraEnv foreach { case (k, v) => jpb.environment.put(k, v) }
+ apply(jpb)
+ }
- def apply(builder: JProcessBuilder): ProcessBuilder = new Simple(builder)
- def apply(file: File): FileBuilder = new FileImpl(file)
- def apply(url: URL): URLBuilder = new URLImpl(url)
- def apply(command: scala.xml.Elem): ProcessBuilder = apply(command.text.trim)
- def apply(value: Boolean): ProcessBuilder = apply(value.toString, if (value) 0 else 1)
+ def apply(builder: JProcessBuilder): ProcessBuilder = new Simple(builder)
+ def apply(file: File): FileBuilder = new FileImpl(file)
+ def apply(url: URL): URLBuilder = new URLImpl(url)
+ def apply(command: scala.xml.Elem): ProcessBuilder = apply(command.text.trim)
+ def apply(value: Boolean): ProcessBuilder = apply(value.toString, if (value) 0 else 1)
- def apply(name: String, exitValue: => Int): ProcessBuilder = new Dummy(name, exitValue)
- def applySeq[T](builders: Seq[T])(implicit convert: T => Source): Seq[Source] = builders.map(convert)
+ def apply(name: String, exitValue: => Int): ProcessBuilder = new Dummy(name, exitValue)
+ def applySeq[T](builders: Seq[T])(implicit convert: T => Source): Seq[Source] = builders.map(convert)
- def cat(file: Source, files: Source*): ProcessBuilder = cat(file +: files)
- def cat(files: Seq[Source]): ProcessBuilder = {
- require(files.nonEmpty)
- files map (_.cat) reduceLeft (_ #&& _)
- }
+ def cat(file: Source, files: Source*): ProcessBuilder = cat(file +: files)
+ def cat(files: Seq[Source]): ProcessBuilder = {
+ require(files.nonEmpty)
+ files map (_.cat) reduceLeft (_ #&& _)
+ }
}
trait ProcessImplicits {
- import Process._
+ import Process._
- implicit def buildersToProcess[T](builders: Seq[T])(implicit convert: T => Source): Seq[Source] = applySeq(builders)
- implicit def builderToProcess(builder: JProcessBuilder): ProcessBuilder = apply(builder)
- implicit def fileToProcess(file: File): FileBuilder = apply(file)
- implicit def urlToProcess(url: URL): URLBuilder = apply(url)
- implicit def xmlToProcess(command: scala.xml.Elem): ProcessBuilder = apply(command)
- implicit def stringToProcess(command: String): ProcessBuilder = apply(command)
- implicit def stringSeqToProcess(command: Seq[String]): ProcessBuilder = apply(command)
+ implicit def buildersToProcess[T](builders: Seq[T])(implicit convert: T => Source): Seq[Source] = applySeq(builders)
+ implicit def builderToProcess(builder: JProcessBuilder): ProcessBuilder = apply(builder)
+ implicit def fileToProcess(file: File): FileBuilder = apply(file)
+ implicit def urlToProcess(url: URL): URLBuilder = apply(url)
+ implicit def xmlToProcess(command: scala.xml.Elem): ProcessBuilder = apply(command)
+ implicit def stringToProcess(command: String): ProcessBuilder = apply(command)
+ implicit def stringSeqToProcess(command: Seq[String]): ProcessBuilder = apply(command)
}