as the code:
1、set phridge.config.stdout to my stream
2、phridge.spawn() to create phantomA and phantomB
3、phantomA.dispose()
4、open a page by phantomB. i am sure that phantom has accessed the local page by log, but the phantom stdout do not through my stream
var phridge = require('phridge');
var through = require('through'); //https://github.com/dominictarr/through
//set stdout to the two-way stream(by through), so i handle the messages from phantom
phridge.config.stdout = through(function(buf){
console.log(buf.toString());
this.queue(buf);
}, function(){
this.queue(null)
});
var phantomA, phantomB;
phridge.spawn()
.then(function(phantom){
phantomA = phantom;
return phridge.spawn();
})
.then(function(phantom){
phantomB = phantom;
return phantomA.dispose();
})
.then(function(){
var page = phantomB.createPage();
return page.run(function(resolve){
var page = this;
page.open('http://localhost/touch', function(){
console.log(page.url); //not to my std stream
resolve();
})
})
})
.then(function(){
console.log('done');
});
i need help, friends~
as the code: 1、set
phridge.config.stdout
to my stream 2、phridge.spawn()
to createphantomA
andphantomB
3、phantomA.dispose()
4、open a page byphantomB
. i am sure that phantom has accessed the local page by log, but the phantom stdout do not through my streamsome advice?? thank you!