Fix potential hang in the example scripts due to missing exit() call.

Patch by Jônatas Pedraza <jonatas.nona@gmail.com> and Vivek Galatage
<vivekgalatage@gmail.com>.

http://code.google.com/p/phantomjs/issues/detail?id=922
1.8
Ariya Hidayat 2012-12-16 23:01:25 -08:00
parent 15fe514025
commit 9c0888d54d
3 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,7 @@ else
page.open address, (status) -> page.open address, (status) ->
if status isnt 'success' if status isnt 'success'
console.log 'FAIL to load the address' console.log 'FAIL to load the address'
phantom.exit()
else else
window.setTimeout -> window.setTimeout ->
sniffed = page.evaluate(-> sniffed = page.evaluate(->

View File

@ -41,6 +41,7 @@ if (system.args.length === 1) {
page.open(address, function (status) { page.open(address, function (status) {
if (status !== 'success') { if (status !== 'success') {
console.log('FAIL to load the address'); console.log('FAIL to load the address');
phantom.exit();
} else { } else {
window.setTimeout(function () { window.setTimeout(function () {
sniffed = page.evaluate(function () { sniffed = page.evaluate(function () {

View File

@ -21,6 +21,7 @@ if (system.args.length < 3 || system.args.length > 5) {
page.open(address, function (status) { page.open(address, function (status) {
if (status !== 'success') { if (status !== 'success') {
console.log('Unable to load the address!'); console.log('Unable to load the address!');
phantom.exit();
} else { } else {
window.setTimeout(function () { window.setTimeout(function () {
page.render(output); page.render(output);