Merge pull request #118 from humphd/issue117
Fix failing null-byte case in PhantomJS for fs.truncate. Fixes #117
This commit is contained in:
commit
513ffb366a
|
@ -2291,7 +2291,13 @@ define(function(require) {
|
||||||
if(error) callback(error);
|
if(error) callback(error);
|
||||||
};
|
};
|
||||||
FileSystem.prototype.truncate = function(path, length, callback) {
|
FileSystem.prototype.truncate = function(path, length, callback) {
|
||||||
|
// Follow node.js in allowing the `length` to be optional
|
||||||
|
if(typeof length === 'function') {
|
||||||
|
callback = length;
|
||||||
|
length = 0;
|
||||||
|
}
|
||||||
callback = maybeCallback(callback);
|
callback = maybeCallback(callback);
|
||||||
|
length = typeof length === 'number' ? length : 0;
|
||||||
var fs = this;
|
var fs = this;
|
||||||
var error = fs.queueOrRun(
|
var error = fs.queueOrRun(
|
||||||
function() {
|
function() {
|
||||||
|
|
Loading…
Reference in New Issue