Skip to content

Instantly share code, notes, and snippets.

@ralphtheninja
Created March 4, 2013 17:17
Show Gist options
  • Select an option

  • Save ralphtheninja/5083838 to your computer and use it in GitHub Desktop.

Select an option

Save ralphtheninja/5083838 to your computer and use it in GitHub Desktop.
This works. Apparently there has to be a final consumer of the last stdout, for example /dev/null in this case, or some other file descriptor.
#!/usr/bin/env node
var spawn = require('child_process').spawn
, child = spawn('mplayer', ['-'])
, fs = require('fs')
, movie = fs.createReadStream('./video')
movie.pipe(child.stdin)
child.stdout.pipe(fs.createWriteStream('/dev/null'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment