title: Spawn in nodejs for a unix command with spaces in parameters
body: <p>I would like to execute the following command using nodejs Spawn on a Debian system :
  <code>
  /usr/bin/apt-get upgrade -s | tail -1 | cut -f1 -d' '
  </code>
  I want to use spawn and not exec because of future use of root only commands and i don't want to allow a full shell access (i will update the visudo file with correct commands) 
  Here is my code</p>
  
  <pre><code>  const apt = spawn('/usr/bin/apt-get', ['upgrade', '-s']);
    const tail = spawn('tail', ['-1']);
    const cut = spawn('cut', ['-f1', '-d" "']);
  
    apt.stdout.on('data', (data) =&gt; {
      tail.stdin.write(data);
    });
  
    tail.stdout.on('data', (data) =&gt; {
      cut.stdin.write(data);
    });
  
    cut.stdout.on('data', (data) =&gt; {
      console.log(data.toString());
    });
  
  
    apt.stderr.on('data', (data) =&gt; {
      console.log("apt stderr: ${data}");
    });
  
    tail.stderr.on('data', (data) =&gt; {
      console.log("tail stderr: ${data}");
    });
  
    cut.stderr.on('data', (data) =&gt; {
      console.log("cut stderr: ${data}");
    });
  
    apt.on('close', (code) =&gt; {
      if (code !== 0) {
        console.log("apt process exited with code ${code}");
      }
    });
  
    tail.on('close', (code) =&gt; {
      if (code !== 0) {
        console.log("tail process exited with code ${code}");
      }
    });
  
    cut.on('close', (code) =&gt; {
      if (code !== 0) {
        console.log("cut process exited with code ${code}");
      }
    });
  
    res.status(200).json('');
  </code></pre>
  
  <p>Once executed i have an error because of the '-d" "' parameter that is not recognized. I try escaping the space with a double \ or split the parameter in both but still errors</p>