From 335da67693fb03f384b8d10dbba795de255ad3b3 Mon Sep 17 00:00:00 2001 From: "Daniel C. Sobral" Date: Thu, 1 Dec 2011 16:56:32 -0200 Subject: Example in scala.sys.process didn't match the text that describes it. Fixed. --- src/library/scala/sys/process/package.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/library/scala/sys/process/package.scala b/src/library/scala/sys/process/package.scala index 17636c4c87..3eb0e5bb89 100644 --- a/src/library/scala/sys/process/package.scala +++ b/src/library/scala/sys/process/package.scala @@ -47,8 +47,9 @@ package scala.sys { * * {{{ * import java.io.File + * import java.net.URL * import scala.sys.process._ - * new File("About.html") #> new File("About_copy.html") ! + * new URL("http://www.scala-lang.org/") #> new File("scala-lang.html") ! * }}} * * One may use a `Process` directly through `ProcessBuilder`'s `run` method, which starts the process in -- cgit v1.2.3 From 8b8ed9980b9f35a16cd55744937e67cff02ea6f1 Mon Sep 17 00:00:00 2001 From: "Daniel C. Sobral" Date: Wed, 14 Sep 2011 18:45:48 -0300 Subject: Makes it possible to use env(1) to run scala scripts, by dropping the requirement of a !# line when using it. This is how some other languages, such as ruby, are run. Typical usage: #!/usr/bin/env scala println("Hello, "+args(0)+"!") Contributed by: Daniel C. Sobral --- src/compiler/scala/tools/nsc/util/SourceFile.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala index 22820806be..4405b3457b 100644 --- a/src/compiler/scala/tools/nsc/util/SourceFile.scala +++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala @@ -72,7 +72,7 @@ object ScriptSourceFile { * with "!#" or "::!#". */ def headerLength(cs: Array[Char]): Int = { - val headerPattern = Pattern.compile("""^(::)?!#.*(\r|\n|\r\n)""", Pattern.MULTILINE) + val headerPattern = Pattern.compile("""((?m)^(::)?!#.*|^.*/env .*)(\r|\n|\r\n)""") val headerStarts = List("#!", "::#!") if (headerStarts exists (cs startsWith _)) { -- cgit v1.2.3