-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finished event called too soon #4
Comments
I have the same issue as the previous poster. I had a quick look at the source code, and it seems that the parser's flush-callback is called, after emitting the 'close' event. It works for me if I change... Parse.prototype._flush = function (callback) {
if (!this._streamEnd || !this._streamFinish) {
return setImmediate(this._flush.bind(this, callback));
}
this.emit('close');
return callback();
}; ...to... Parse.prototype._flush = function (callback) {
if (!this._streamEnd || !this._streamFinish) {
return setImmediate(this._flush.bind(this, callback));
}
var r = callback();
this.emit('close');
return r;
}; |
Parser's flush callback was called after emitting 'close'-event.
Good find 👍 If it's just a callback I expect there's no point returning the result from it. Likely the original return was just a tail call. Haven't tried it to be honest, but it would come down to Parse.prototype._flush = function (callback) {
if (!this._streamEnd || !this._streamFinish) {
return setImmediate(this._flush.bind(this, callback));
}
callback();
this.emit('close');
}; |
I had the same issue. Except that my problem was that my |
I also encountered this issue. Calling |
After unzipping I immediatly traverse the directory structure with walk. The last few directories that were unzipped are always missed on the content traversal. If I trigger the same code on an already unzipped directory it finds all content.
To me it looks like the "finished" event is called prematurely. I've tested this on node 0.10 0.12 and iojs 1.5 and all give the same behavior.
Or is this expected behavior and should I somehow work around it? I've now solved it by simply making the excution wait a little while before doing the walk but that is a hack of course, and not very reliable at all.
The text was updated successfully, but these errors were encountered: