This page is no longer maintained — Please continue to the home page at www.scala-lang.org

scala.tools.cmd.Demo

No replies
Doug Donohoe
Joined: 2011-08-10,
User offline. Last seen 1 year 9 weeks ago.

I'm relatively new to Scala and am looking to use Scala to replace
bash scripts. I stumbled upon the "scala.tools.cmd.Demo" class and am
trying to use it.

The explanation in the Scaladoc is to run

scala scala.tools.cmd.Demo --self-update demo

followed by

`./demo --bash`

However the 2nd command produced an error similar to

-bash: /path/to/-Tmp-/scala.cmd.bash2567948935194166399.tmp: No such
file or directory

I discovered that this happens because the scala.tools.cmd.Meta.Bash
object uses File.makeTemp, which in turn creates a temp file and then
calls deleteOnExit() immediately. Thus this code generates some bash
code which is immediately deleted when the JVM finishes, causing the
above error.

So this is obviously broken - perhaps the makeTemp previously did not
call deleteOnExit()? I'm posting to

(a) point out that this is broken

and

(b) ask if there are any good DSLs and/or tutorials for bash/unix like-
scripting via scala.

Thanks,

-Doug

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland