Merge pull request #118 from humphd/issue117

Fix failing null-byte case in PhantomJS for fs.truncate. Fixes #117
This commit is contained in:
Alan K 2014-02-18 11:07:32 -05:00
commit 513ffb366a
1 changed files with 6 additions and 0 deletions

View File

@ -2291,7 +2291,13 @@ define(function(require) {
if(error) callback(error);
};
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);
length = typeof length === 'number' ? length : 0;
var fs = this;
var error = fs.queueOrRun(
function() {