title: shell command to child_process.spawn(command, [args], [options]) node.js
body: <p>Basically, I just want to run rsync command on node app.</p>
  
  <p>The raw rsync code is the below:</p>
  
  <pre><code>rsync -r -t -p -o -g -v --progress --delete -l -H /Users/ken/Library/Application Support/Sublime Text 3/Packages /Users/ken/Google Drive/__config-GD/ST3
  </code></pre>
  
  <p>Firstly, I tried </p>
  
  <pre><code>child_process.exec(command, [options], callback)
  </code></pre>
  
  <p>but, since the rsync output is long, the buffer exceeded.</p>
  
  <p>So, I tried </p>
  
  <pre><code>child_process.spawn(command, [args], [options])
  </code></pre>
  
  <p>instead, and stream.pipe out.</p>
  
  <pre><code>var spawn = require('child_process')
          .spawn;
  var ps = spawn(command1, args1)
          .stdout
          .pipe(process.stdout);
  </code></pre>
  
  <p>Although this works as expected, it is way too hard to split every original rsync command to the spawn format. (I copied and paste the command from gRsync tool)</p>
  
  <p>Is there smart way to do this?</p>
  
  <p>Thanks.</p>