- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
scala.tools.cmd.Demo
Wed, 2011-08-10, 22:43
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