title: Why won't gradle Exec task run my command?
body: <p>I have read around stackoverflow and the gradle forms, but I am still stumped.  The ultimate goal here is that after I copy some files, I want to set the writable flag -- because 'copy' doesn't like overwriting read-only files on 'nix (huh...), nor can it be forced to do so (harumph!).</p>
  
  <p>Here is the outline of what I have:</p>
  
  <pre><code>task setPermissions (type : Exec) {
    executable = 'chmod -R +w'
  }
  
  // ... a little while later ...
  
  task('somethingElse') &lt;&lt; {
    // ... unrelated stuff ...
    def String targetDir = "$aVar/theTarget"
  
    // &gt;&gt; TASK CALL &lt;&lt;
    setPermissions {
      commandLine = [executable + " $targetDir"]
    }
  
    // but that doesn't work... this does...
    proc = Runtime.getRuntime().exec("chmod -R +w $deployDir")
    proc.waitFor()
  
  }
  </code></pre>
  
  <p>I have tried variations in "setPermissions".</p>
  
  <p><strong>Trial 1:</strong></p>
  
  <pre><code>commandLine = 'chmod'
  args = '-R', '+w'
  </code></pre>
  
  <p>In which case I appended the target directory to "args" when I called setPermissions.</p>
  
  <p><strong>Trial 2:</strong></p>
  
  <pre><code>commandLine = 'chmod -R +w'
  </code></pre>
  
  <p>In which case I appended the target directory to "commandLine" when I called setPermissions.  I also tried making it the only "args" value.</p>
  
  <p><strong>Trial 3:</strong></p>
  
  <pre><code>commandLine = 'chmod', '-R', '+w'
  </code></pre>
  
  <p>In which case I appended the target directory to "commandLine" when I called setPermissions.  I also tried making it the only "args" value.</p>
  
  <p>So what am I doing wrong here that an Exec task won't run this properly, but the Rt.gR.exec() will?</p>