diff --git a/lib/wrench.js b/lib/wrench.js index 7334757..07386f8 100644 --- a/lib/wrench.js +++ b/lib/wrench.js @@ -175,7 +175,7 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) { var checkDir = fs.statSync(sourceDir); try { fs.mkdirSync(newDirLocation, checkDir.mode); - } catch (e) { + } catch (e) { //if the directory already exists, that's okay if (e.code !== 'EEXIST') throw e; } @@ -368,9 +368,12 @@ exports.LineReader.prototype = { var res = fs.readSync(this.fd, this.bufferSize, position, "ascii"); this.buffer += res[0]; - if(res[1] === 0) return -1; + if(res[1] === 0) { + this.currentPosition = -1; + } else { + this.currentPosition = position + res[1]; + } - this.currentPosition = position + res[1]; return this.currentPosition; },