title: How does the “scala.sys.process” from Scala 2.9 work?
body: <p>I just had a look at the new <code>scala.sys</code> and <code>scala.sys.process</code> packages to see if there is something helpful here. However, I am at a complete loss.</p>
  
  <p>Has anybody got an example on how to actually start a process?</p>
  
  <p>And, which is most interesting for me: Can you detach processes?</p>
  
  <p>A detached process will continue to run when the parent process ends and is one of the weak spots of Ant.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>There seem to be some confusion what detach is. Have a real live example from my current project. Once with z-Shell and once with TakeCommand:</p>
  
  <p><em>Z-Shell:</em></p>
  
  <pre><code>if ! ztcp localhost 5554; then
      echo "[ZSH] Start emulator"
      emulator                        \
      -avd    Nexus-One               \
      -no-boot-anim                   \
      1&gt;~/Library/Logs/${PROJECT_NAME}-${0:t:r}.out   \
      2&gt;~/Library/Logs/${PROJECT_NAME}-${0:t:r}.err   &amp;
      disown
  else
      ztcp -c "${REPLY}"
  fi;
  </code></pre>
  
  <p><em>Take-Command:</em></p>
  
  <pre><code>IFF %@Connect[localhost 5554] lt 0 THEN
     ECHO [TCC] Start emulator
     DETACH emulator -avd Nexus-One -no-boot-anim
  ENDIFF
  </code></pre>
  
  <p>In both cases it is fire and forget, the emulator is started and will continue to run even after the script has ended. Of course having to write the scripts twice is a waste. So I look into Scala now for unified process handling without cygwin or xml syntax.</p>