Skip to content

Commit

Permalink
Work around Node 0.8 brokenness with using /dev/stdin in subprocesses.
Browse files Browse the repository at this point in the history
  • Loading branch information
glasser committed Sep 19, 2012
1 parent 125cf21 commit e27304c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/spiderable/spiderable.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
// Use '/dev/stdin' to avoid writing to a temporary file. Can't
// just omit the file, as PhantomJS takes that to mean 'use a
// REPL' and exits as soon as stdin closes.
var cp = spawn('phantomjs', ['--load-images=no', '/dev/stdin']);
//
// However, Node 0.8 broke the ability to open /dev/stdin in the
// subprocess; see https://gist.github.com/3751746 for the gory
// details. Work around this with a not-so-useless use of cat.
var cp = spawn('bash',
['-c', 'cat | phantomjs --load-images=no /dev/stdin']);

var data = '';
cp.stdout.setEncoding('utf8');
Expand Down

0 comments on commit e27304c

Please sign in to comment.