-
Notifications
You must be signed in to change notification settings - Fork 20
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
process.on("exit", fn) not being respected #7
Comments
Rebased on top of 0.1.2 via e90e70e. |
In 0778a33 I've overridden Thoughts? /cc @sindresorhus |
@cowboy I'm confused... maybe you can shed some light on this: As I understand it, using Consider the following case:
If I'm not mistaken, doContinue may be called in this case but it would never be called when using |
I dunno. |
Opinions? (Sorry to keep bothering...) Why is it a good idea to prevent further writing to streams in (I feel it causes more harm than good as it breaks process exit handlers writing to streams and somehow tries to conceal the changed exit semantics of |
I'm operating under the assumption that once Does that seem fair? I was addressing the part of that assumption that deals with output stdout and stderr logging, since that's how this issue manifests itself in my code. I'm not sure how to handle anything other than that. |
@alimfeld the goal is to eliminate inconsistencies, I believe if streams are allowed then you get different outputs between UNIX and Win32. So currently the plan is try and find a way to make |
@cowboy fair enough... thanks for clarifying 😄 |
0778a33 works for me! We use |
Any new ideas on this? It's been a while. |
The testcase is flawed. It works fine on OS X since process.exit() is called by it. module.exports = function (grunt) {
console.log("before");
process.on("exit", function() {
console.log("on exit");
});
process.exit();
console.log("after");
}; but don't if you leave it up to grunt to call process.exit(). Like: module.exports = function (grunt) {
console.log("before");
process.on("exit", function() {
console.log("on exit");
});
console.log("after");
};
|
Any chance of merging the fix? |
@sindresorhus Can you provide a full test case? The following: console.log("before");
process.on("exit", function() {
console.log("on exit");
});
console.log("after"); properly logs:
on OS X 10.9.2. EDIT: Nvm, I wasn't using the |
On Windows, when running mocha after jshint, all mocha output (passes, failures, which tests failed, etc) is truncated due to this bug: cowboy/node-exit#7.
Any news on this status of this bug? Should I still be downgrading to Grunt 0.4.1? Is there a branch that works that can be used in the meantime? |
Oh my, and I was wondering why
inside my task isn't doing anything. So, Grunt v1.0.0 is affected by this, right? |
See sindresorhus/time-grunt#15.
Given the following code:
before
thenon exit
.require("exit")();
instead ofprocess.exit();
onlybefore
is logged.on exit
should be logged.Take a look at this commit in the node-exit branch.
Granted, that code is currently failing... but if we can fix it, we might be able to allow @sindresorhus's plugin to continue working.
Possible solution: Set
stream.write
to a NOP function after theexit
event has been called?The text was updated successfully, but these errors were encountered: