title: Process started with java's Process.exec always returns exit code 0
body: <p>I start shell scripts with java <code>Process.exec</code> (for reasons), and they always return 0 exit value, regardless of exit value of script itself (which I can check by running said script in OS shell. For additional info, those scripts run gradle tasks with <code>gradle-node-plugin</code>. Any pointers for this issue?</p>
  
  <p>Overall, setup looks as follows:  </p>
  
  <p>Software </p>
  
  <ul>
  <li><p>Linux desktop 4.4.0-130-generic #156~14.04.1-Ubuntu SMP Thu Jun 14 13:51:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux`</p></li>
  <li><p>java version "1.8.0_171"
  Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
  Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)`</p></li>
  </ul>
  
  <p>Shell script is executed with</p>
  
  <pre><code>Process process = Runtime.getRuntime().exec(new String[]{"sh", "-c", testScript});
  </code></pre>
  
  <p>Return value is obtained with <code>test.exitValue()</code>, and appears to be always 0.</p>
  
  <p>Shell script calls gradle <code>./gradlew project:clean project:test</code>.</p>
  
  <p>Gradle scripts relies on <code>gradle-node-plugin</code></p>
  
  <pre><code>plugins {
      id "com.moowork.node" version "1.2.0"
  }
  
  task test(type: NodeTask) {
      script = file('./node_modules/mocha/bin/mocha')
      args = ['test/sometest.js']
  }
  </code></pre>