Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Fixed required module name and spawn execution
Browse files Browse the repository at this point in the history
Fixed required webpage module name, previously it was require('page') which is incorrect. And also added setTimeout function for phantom.exit() as it was getting called before spawn() call can get completed.
  • Loading branch information
k-sau committed Apr 20, 2016
1 parent 59c489b commit 49a45e0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions _posts/api/child_process/method/2000-01-01-spawn.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ permalink: api/child_process/method/spawn.html
## Examples

```javascript
var page = require('page').create();
var page = require('webpage').create();
var spawn = require('child_process').spawn;

page.open('http://google.com', function(status){
if( status == 'success' ) {
page.render('/tmp/google-snapshot.jpg');
spawn('/usr/bin/sensible-browser', 'file:///tmp/google-snapshot.jpg');
phantom.exit();
}
})
setTimeout(function(){
phantom.exit();
},2000);
});

```

Expand Down

0 comments on commit 49a45e0

Please sign in to comment.