-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
isNodeJS check #645
Comments
Or |
Do these environments also provide a bad process.nextTick? |
Come back and re-open this if process.nextTick is bad on these fake Node environments. The isNode test just means that Q will use process.nextTick and check whether process.domain exists when necessary. It should not have any harmful side effects. |
The problem is this in flush: try {
task();
} catch (e) {
if (isNodeJS) {
// In node, uncaught exceptions are considered fatal errors.
// Re-throw them synchronously to interrupt flushing!
// Ensure continuation if the uncaught exception is suppressed
// listening "uncaughtException" events (as domains does).
// Continue in next event to avoid tick recursion.
if (domain) {
domain.exit();
}
setTimeout(flush, 0);
if (domain) {
domain.enter();
}
throw e;
} else {
// In browsers, uncaught exceptions are not fatal.
// Re-throw them asynchronously to avoid slow-downs.
setTimeout(function() {
throw e;
}, 0);
}
} It thinks that the browser |
@kriskowal as mentionned in the linked issue I got a problem with this too. @dominataa is right, the problem seems to be related to the synchronous exception rethrow in case of isNodeJs = true, in case of a Browserify context. This would be nice to be able to disable the "fail fast flushing behavior" used for NodeJS ( |
This problem appeared between releases Browserify 8.0.3 and 8.1.0. Q works fine with older versions of Browserify |
I've made a PR for node-process/browserify that solves this problem. |
can confirm Q does some funky stuff in browserify because it thinks it's in node |
This happens with Webpack as well. It's killing our test suite and causing early exits instead of just test failures. It is definitely a bug with the flush in Q and not with the shim's in browserify and webpack. |
This has been addressed by @kahnjw in v1.2.1. Thanks for the tips. |
Hi, in asap.js you are checking whether the environment
isNodeJS
.We do have a fake environment with browserify where process.nextTick is used and this check is causing errors to be thrown synchronously causing issues.
One suggestion from ksmeltzer was to use
process.title === 'node'
. The problem is we have window in both envs and process etc..The text was updated successfully, but these errors were encountered: