minor fix for sync image rendering.

This commit is contained in:
Christopher Jeffrey 2015-05-05 19:17:16 -07:00
parent ce7cab13ba
commit 99f9d622e6
1 changed files with 6 additions and 5 deletions

View File

@ -8962,7 +8962,7 @@ Image.prototype.renderImage = function(img, ratio, callback) {
var self = this;
if (cp.execSync) {
callback = callback || function() {};
callback = callback || function(err, result) { return result; };
try {
return callback(null, this.renderImageSync(img, ratio));
} catch (e) {
@ -9031,7 +9031,7 @@ Image.prototype.clearImage = function(callback) {
var self = this;
if (cp.execSync) {
callback = callback || function() {};
callback = callback || function(err, result) { return result; };
try {
return callback(null, this.clearImageSync());
} catch (e) {
@ -9094,7 +9094,7 @@ Image.prototype.imageSize = function(callback) {
var img = this.file;
if (cp.execSync) {
callback = callback || function() {};
callback = callback || function(err, result) { return result; };
try {
return callback(null, this.imageSizeSync());
} catch (e) {
@ -9153,7 +9153,7 @@ Image.prototype.termSize = function(callback) {
var self = this;
if (cp.execSync) {
callback = callback || function() {};
callback = callback || function(err, result) { return result; };
try {
return callback(null, this.termSizeSync());
} catch (e) {
@ -9212,7 +9212,7 @@ Image.prototype.getPixelRatio = function(callback) {
var self = this;
if (cp.execSync) {
callback = callback || function() {};
callback = callback || function(err, result) { return result; };
try {
return callback(null, this.getPixelRatioSync());
} catch (e) {
@ -9394,6 +9394,7 @@ Image.prototype.termSizeSync = function(_, recurse) {
if (!buf.trim()) {
// Bug: w3mimgdisplay will sometimes
// output nothing. Try again:
recurse = recurse || 0;
if (++recurse === 5) {
throw new Error('Term size not determined.');
}