Skip to content

Commit

Permalink
Fixed missing exit code when errornous.
Browse files Browse the repository at this point in the history
  • Loading branch information
brikou authored and ariya committed May 18, 2012
1 parent 7142585 commit 1125b86
Show file tree
Hide file tree
Showing 30 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion examples/detectsniff.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ page.onInitialized = ->

if system.args.length is 1
console.log 'Usage: unsniff.coffee <some URL>'
phantom.exit()
phantom.exit 1
else
address = system.args[1]
console.log 'Checking ' + address + '...'
Expand Down
2 changes: 1 addition & 1 deletion examples/detectsniff.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ page.onInitialized = function () {

if (system.args.length === 1) {
console.log('Usage: unsniff.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
address = system.args[1];
console.log('Checking ' + address + '...');
Expand Down
2 changes: 1 addition & 1 deletion examples/direction.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ system = require 'system'
if system.args.length < 3
console.log 'Usage: direction.coffee origin destination'
console.log 'Example: direction.coffee "San Diego" "Palo Alto"'
phantom.exit(1)
phantom.exit 1
else
origin = system.args[1]
dest = system.args[2]
Expand Down
2 changes: 1 addition & 1 deletion examples/echoToFile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ system = require 'system'

if system.args.length < 3
console.log "Usage: echoToFile.coffee DESTINATION_FILE <arguments to echo...>"
phantom.exit()
phantom.exit 1
else
content = ""
f = null
Expand Down
2 changes: 1 addition & 1 deletion examples/echoToFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var fs = require('fs'),

if (system.args.length < 3) {
console.log("Usage: echoToFile.js DESTINATION_FILE <arguments to echo...>");
phantom.exit();
phantom.exit(1);
} else {
var content = '',
f = null;
Expand Down
2 changes: 1 addition & 1 deletion examples/imagebin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ system = require 'system'

if system.args.length isnt 2
console.log 'Usage: imagebin.coffee filename'
phantom.exit()
phantom.exit 1
else
fname = system.args[1]
page.open 'http://imagebin.org/index.php?page=add', ->
Expand Down
2 changes: 1 addition & 1 deletion examples/imagebin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var page = require('webpage').create(),

if (system.args.length !== 2) {
console.log('Usage: imagebin.js filename');
phantom.exit();
phantom.exit(1);
} else {
fname = system.args[1];
page.open("http://imagebin.org/index.php?page=add", function () {
Expand Down
2 changes: 1 addition & 1 deletion examples/loadspeed.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ system = require 'system'

if system.args.length is 1
console.log 'Usage: loadspeed.coffee <some URL>'
phantom.exit()
phantom.exit 1
else
t = Date.now()
address = system.args[1]
Expand Down
2 changes: 1 addition & 1 deletion examples/loadspeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var page = require('webpage').create(),

if (system.args.length === 1) {
console.log('Usage: loadspeed.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
t = Date.now();
address = system.args[1];
Expand Down
2 changes: 1 addition & 1 deletion examples/netlog.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ system = require 'system'

if system.args.length is 1
console.log 'Usage: netlog.coffee <some URL>'
phantom.exit()
phantom.exit 1
else
address = system.args[1]
page.onResourceRequested = (req) ->
Expand Down
2 changes: 1 addition & 1 deletion examples/netlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var page = require('webpage').create(),

if (system.args.length === 1) {
console.log('Usage: netlog.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
address = system.args[1];

Expand Down
2 changes: 1 addition & 1 deletion examples/netsniff.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ system = require 'system'

if system.args.length is 1
console.log 'Usage: netsniff.coffee <some URL>'
phantom.exit()
phantom.exit 1
else
page.address = system.args[1]
page.resources = []
Expand Down
2 changes: 1 addition & 1 deletion examples/netsniff.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var page = require('webpage').create(),

if (system.args.length === 1) {
console.log('Usage: netsniff.coffee <some URL>');
phantom.exit();
phantom.exit(1);
} else {

page.address = system.args[1];
Expand Down
2 changes: 1 addition & 1 deletion examples/postserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var page = require('webpage').create(),

if (system.args.length !== 2) {
console.log('Usage: postserver.js <portnumber>');
phantom.exit();
phantom.exit(1);
}

var port = system.args[1];
Expand Down
2 changes: 1 addition & 1 deletion examples/printheaderfooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function someCallback(pageNum, numPages) {

if (system.args.length < 3) {
console.log('Usage: printheaderfooter.js URL filename');
phantom.exit();
phantom.exit(1);
} else {
var address = system.args[1];
var output = system.args[2];
Expand Down
2 changes: 1 addition & 1 deletion examples/printmargins.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var page = require('webpage').create(),
if (system.args.length < 7) {
console.log('Usage: printmargins.js URL filename LEFT TOP RIGHT BOTTOM');
console.log(' margin examples: "1cm", "10px", "7mm", "5in"');
phantom.exit();
phantom.exit(1);
} else {
var address = system.args[1];
var output = system.args[2];
Expand Down
2 changes: 1 addition & 1 deletion examples/rasterize.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ system = require 'system'
if system.args.length < 3 or system.args.length > 4
console.log 'Usage: rasterize.coffee URL filename [paperwidth*paperheight|paperformat]'
console.log ' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'
phantom.exit()
phantom.exit 1
else
address = system.args[1]
output = system.args[2]
Expand Down
2 changes: 1 addition & 1 deletion examples/rasterize.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var page = require('webpage').create(),
if (system.args.length < 3 || system.args.length > 4) {
console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat]');
console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"');
phantom.exit();
phantom.exit(1);
} else {
address = system.args[1];
output = system.args[2];
Expand Down
4 changes: 2 additions & 2 deletions examples/run-jasmine.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
if not condition
# If condition still not fulfilled (timeout but condition is 'false')
console.log "'waitFor()' timeout"
phantom.exit(1)
phantom.exit 1
else
# Condition fulfilled (timeout and/or condition is 'true')
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."
Expand All @@ -33,7 +33,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->

if system.args.length isnt 2
console.log 'Usage: run-jasmine.coffee URL'
phantom.exit()
phantom.exit 1

page = require('webpage').create()

Expand Down
2 changes: 1 addition & 1 deletion examples/run-jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function waitFor(testFx, onReady, timeOutMillis) {

if (system.args.length !== 2) {
console.log('Usage: run-jasmine.js URL');
phantom.exit();
phantom.exit(1);
}

var page = require('webpage').create();
Expand Down
6 changes: 3 additions & 3 deletions examples/run-qunit.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
if not condition
# If condition still not fulfilled (timeout but condition is 'false')
console.log "'waitFor()' timeout"
phantom.exit(1)
phantom.exit 1
else
# Condition fulfilled (timeout and/or condition is 'true')
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."
Expand All @@ -33,7 +33,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->

if system.args.length isnt 2
console.log 'Usage: run-qunit.coffee URL'
phantom.exit(1)
phantom.exit 1

page = require('webpage').create()

Expand All @@ -44,7 +44,7 @@ page.onConsoleMessage = (msg) ->
page.open system.args[1], (status) ->
if status isnt 'success'
console.log 'Unable to access network'
phantom.exit(1)
phantom.exit 1
else
waitFor ->
page.evaluate ->
Expand Down
2 changes: 1 addition & 1 deletion examples/scandir.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ system = require 'system'

if system.args.length != 2
console.log "Usage: phantomjs scandir.coffee DIRECTORY_TO_SCAN"
phantom.exit()
phantom.exit 1
scanDirectory = (path) ->
fs = require 'fs'
if fs.exists(path) and fs.isFile(path)
Expand Down
2 changes: 1 addition & 1 deletion examples/scandir.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var system = require('system');

if (system.args.length !== 2) {
console.log("Usage: phantomjs scandir.js DIRECTORY_TO_SCAN");
phantom.exit();
phantom.exit(1);
}

var scanDirectory = function (path) {
Expand Down
2 changes: 1 addition & 1 deletion examples/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var host, port;

if (system.args.length !== 2) {
console.log('Usage: server.js <some port>');
phantom.exit();
phantom.exit(1);
} else {
port = system.args[1];
var listening = server.listen(port, function (request, response) {
Expand Down
2 changes: 1 addition & 1 deletion examples/serverkeepalive.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var port, server, service,

if (system.args.length !== 2) {
console.log('Usage: serverkeepalive.js <portnumber>');
phantom.exit();
phantom.exit(1);
} else {
port = system.args[1];
server = require('webserver').create();
Expand Down
2 changes: 1 addition & 1 deletion examples/simpleserver.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ system = require 'system'

if system.args.length is 1
console.log "Usage: simpleserver.coffee <portnumber>"
phantom.exit()
phantom.exit 1
else
port = system.args[1]
server = require("webserver").create()
Expand Down
2 changes: 1 addition & 1 deletion examples/simpleserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var port, server, service,

if (system.args.length !== 2) {
console.log('Usage: simpleserver.js <portnumber>');
phantom.exit();
phantom.exit(1);
} else {
port = system.args[1];
server = require('webserver').create();
Expand Down
2 changes: 1 addition & 1 deletion examples/sleepsort.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ system = require 'system'

if system.args.length < 2
console.log "Usage: phantomjs sleepsort.coffee PUT YOUR INTEGERS HERE SEPARATED BY SPACES"
phantom.exit()
phantom.exit 1
else
sortedCount = 0
args = Array.prototype.slice.call(system.args, 1)
Expand Down
2 changes: 1 addition & 1 deletion examples/sleepsort.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function sleepSort(array, callback) {

if ( system.args < 2 ) {
console.log("Usage: phantomjs sleepsort.js PUT YOUR INTEGERS HERE SEPARATED BY SPACES");
phantom.exit();
phantom.exit(1);
} else {
sleepSort(Array.prototype.slice.call(system.args, 1), function() {
phantom.exit();
Expand Down
2 changes: 1 addition & 1 deletion examples/waitfor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
if not condition
# If condition still not fulfilled (timeout but condition is 'false')
console.log "'waitFor()' timeout"
phantom.exit(1)
phantom.exit 1
else
# Condition fulfilled (timeout and/or condition is 'true')
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."
Expand Down

0 comments on commit 1125b86

Please sign in to comment.