Groovy script can't execute() external process
<p>Main question: Would groovy's <code>execute()</code> method allow me to run a command that takes a file as an argument, any maybe run the command in background mode?</p>

<p>Here is my issue. I was able to use groovy's <code>execute()</code> for simple commands like <code>ls</code> for example. Suppose now I want to start a process like Kafka from a groovy script (end result is to replace <code>bash</code> files with groovy scripts). So I start with these lines:</p>

<pre><code>def kafkaHome = "Users/mememe/kafka_2.11-0.9.0.1"
def zkStart = "$kafkaHome/bin/zookeeper-server-start.sh" 
def zkPropsFile = "$kafkaHome/config/zookeeper.properties"
</code></pre>

<p>Now, executing the command below form my mac terminal:</p>

<pre><code>/Users/mememe/kafka_2.11-0.9.0.1/bin/zookeeper-server-start.sh /Users/mememe/kafka_2.11-0.9.0.1/config/zookeeper.properties 
</code></pre>

<p>starts up the the process just fine. And, executing this statement:</p>

<pre><code>println "$zkStart $zkPropsFile" 
</code></pre>

<p>prints the above command line as is. However, executing this command from within the groovy script:</p>

<pre><code>println "$zkStart $zkPropsFile".execute().text
</code></pre>

<p>simply hangs! And trying this:</p>

<pre><code>println "$zkStart $zkPropsFile &amp;".execute().text
</code></pre>

<p>where I make it a background process goes further, but starts complaining about the input file and throws this exception:</p>

<pre><code>java.lang.NumberFormatException: For input string: "/Users/mememe/kafka_2.11-0.9.0.1/config/zookeeper.properties"
</code></pre>

<p>Trying this gives the same exception as above:</p>

<pre><code>def proc = ["$zkStart", "$zkPropsFile", "&amp;"].execute()
println proc.text
</code></pre>

<p>What am I missing please? Thank you.</p>