Shadowfiend/sbt-resource-management — pull request #12 by farmdawgnation (2012-11-22 15:40:32+00:00)
Title: java.lang.Runtime.exec overwrites environment.

Around line 184 (in my branch, may vary in master for now) in doSassCompile we have the following code:

```scala
val process =
runtime.exec(
("compass" :: "compile" :: "-e" :: "production" :: "--force" :: Nil).toArray,
("asset_domain=" + bucket :: Nil).toArray)
```

This is a grand way to set the asset domain for compass, but it wreaks havoc if you're running this code on a system with RVM installed because, according to the [javadoc](http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[], java.lang.String[], java.io.File)), it overwrites the environment that RVM set. The net result is that when compass runs it fails with a path error.

```
matt@FarmStudy:~/Sites/anchor-tab-scala(master)$ sbt resources:compile-sass
...
[warn] org.scala-lang: 2.9.2, 2.9.1
[info] Compiling SASS files...
[error] env: ruby_noexec_wrapper: No such file or directory
java.lang.RuntimeException: SASS compilation failed with code 127.
```

I confirmed this was the issue by changing the second parameter in exec to `null`, and compass started working again (presumably because it had the correct environment).

It looks like `System` has a getenv call. One possible fix for this is:

```scala
val environment = System.getenv().map { case (key, value) => key + "=" + value }
++ ("asset_domain=" + bucket)
val process =
runtime.exec(
("compass" :: "compile" :: "-e" :: "production" :: "--force" :: Nil).toArray,
environment
```

Interested in hearing any thoughts along those lines. Might try implementing it myself.