Created
April 7, 2015 17:29
-
-
Save terinjokes/0b198b330fabb52b6b5f to your computer and use it in GitHub Desktop.
Test file for browserify/browserify#1200
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var browserify = require('./'); | |
var through = require('through2'); | |
var b = browserify('./test/entry/main'); | |
var spawn = require('child_process').spawn; | |
var wrap = b.pipeline.get('wrap'); | |
var n = spawn('node'); | |
var out = through(); | |
var t = through(function(row, enc, next) { | |
this.push(new Buffer('alert("hello world");')); | |
next(); | |
}, function(next) { | |
n.stdout.pipe(out); | |
n.stderr.pipe(process.stderr); | |
b.on('exit', function(code) { | |
if (code) { | |
b.emit('error', new Error('Exit ' + code)); | |
} | |
next(); | |
}); | |
n.stdin.write('console.log(\'alert("hello, spawn");\')'); | |
n.stdin.end(); | |
}); | |
wrap.push(t); | |
wrap.push(out); | |
b.bundle().pipe(process.stdout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment