title: Sending a Ctrl+C SIGINT to sudoed C subprocess from python framework
body: <p>I'm running a python subprocess using:</p>
  <pre><code>p = Popen([&quot;sudo&quot;, &quot;./a.out&quot;])
  </code></pre>
  <p>where <code>a.out</code> is a C executable which runs continuously until a SIGINT or Ctrl+C signal is sent to it. I've had trouble with <code>subprocess.Popen</code> object functions such as <code>send_signal()</code> because <code>Operation not permitted</code> errors are raised due to the <code>sudo</code> nature of the executable. After this I tried to send a SIGINT to the subprocess via:</p>
  <pre><code>os.system(f&quot;sudo kill -2 {p.pid}&quot;)
  </code></pre>
  <p>but this doesn't seem to target the process correctly. Running a quick <code>sudo netstat -lpnt</code> check shows the <code>a.out</code> process is still running on a pid which is different to the one which <code>p.pid</code> returned (usually by a few integers, i.e. <code>p.pid</code> returns 3031 but <code>a.out</code> is 3035). Anything that I've misunderstood?</p>