title: Sending control+c (SIGINT) to NSPIPE in objective-C
body: <p>I am trying to terminate an openvpn task, spawned via NSTask.</p>
  
  <p>My question:</p>
  
  <p>Should I send <kbd>ctrl</kbd>+<kbd>c</kbd> (SIGINT) to the input NSPipe for my NSTask?</p>
  
  <pre><code>inputPipe = [NSPipe pipe]; 
  taskInput = [inputPipe fileHandleForWriting];
  NSString dataString = @"\cC";
  [taskInput writeData:[dataString dataUsingEncoding: [NSString defaultCStringEncoding]]];
  </code></pre>
  
  <p>Alternatively, I was thinking about using kill( pid, SIGINT ); but it would be much more complicated since the process ID has to be determined via a detour ([task processIdentifier] does not help here) - the original NSTask calls:</p>
  
  <pre><code>/bin/bash -c sudo -S | mypassword ....
  </code></pre>
  
  <p>That's not nice, I know but it is only called once and the sudo password has been entered in that case already.</p>