title: node spawn with sudo cannot use ipc
body: <p>In my project, I need to create a child process and communicate with it via IPC, at same time, this child process must run as root. So I use <code>cp.spawn('sudo', ...)</code> with IPC channel, but I found the <code>process.send</code> method is <code>undefined</code>.</p>
  
  <p>Here is the code:</p>
  
  <p><strong>file: parent.js</strong></p>
  
  <pre><code>'use strict'
  
  const cp = require('child_process')
  const path = require('path')
  
  const script = path.join(__dirname, 'child.js')
  
  let child = cp.spawn('sudo', [process.execPath, script], {
    stdio: ['inherit', 'inherit', 'inherit', 'ipc']
  })
  
  child.on('message', msg =&gt; {
    console.log('message&gt; ', msg)
  })
  
  console.log('parent&gt; parent run!')
  </code></pre>
  
  <p><strong>file: child.js</strong></p>
  
  <pre><code>'use strict'
  
  console.log('child&gt; child run!')
  
  process.send('hahaha')
  </code></pre>
  
  <p><strong>run <code>node parent.js</code></strong></p>
  
  <pre><code>parent&gt; parent run!
  Password:
  child&gt; child run!
  /Users/zoujie.wzj/workbench/child.js:5
  process.send('hahaha')
          ^
  
  TypeError: process.send is not a function
      at Object.&lt;anonymous&gt; (/Users/zoujie.wzj/workbench/child.js:5:9)
      at Module._compile (module.js:570:32)
      at Object.Module._extensions..js (module.js:579:10)
      at Module.load (module.js:487:32)
      at tryModuleLoad (module.js:446:12)
      at Function.Module._load (module.js:438:3)
      at Module.runMain (module.js:604:10)
      at run (bootstrap_node.js:394:7)
      at startup (bootstrap_node.js:149:9)
      at bootstrap_node.js:509:3
  </code></pre>
  
  <p><em>Update: After I replace <code>cp.spawn('sudo', ...)</code> with <code>cp.spawn(process.execPath, ...)</code>, the program will work:</em></p>
  
  <pre><code>parent&gt; parent run!
  child&gt; child run!
  message&gt;  hahaha
  </code></pre>
  
  <p>Is anyone knowns why IPC doesn't work with sudo?</p>