title: Runtime.exec() in Android hangs
body: <p>When I try to exec an external script in this way:</p>
  
  <pre><code>try {
      process = Runtime.getRuntime().exec(
          new String[] { "/system/bin/sh", "./myscript.sh" },
          null,
          "/data/mydir",
      );
  } catch (IOException e) {
      Log.e(TAG, e.getMessage(), e);
  } catch (SecurityException e) {
      Log.e(TAG, e.getMessage(), e);
  }
  </code></pre>
  
  <p>Sometimes the script gets executed, but most often my app hangs a couple of seconds until Android says my app is unresponsive and it needs to kill it.</p>
  
  <p>My question is, what may be happening. The script <em>is</em> running sometimes, and there is <em>no</em> exception being thrown, it just hangs. I'm at a loss as to what's happening. I'm using Froyo (2.2.1 I think).</p>
  
  <p>Thanks!</p>