-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
net.listen does not emit 'listening' event when in --eval mode #1600
Comments
wtf. That commit was 2 years ago? Assigning this to myself. |
@trevnorris agreed, seriously wtf. Looking forward to the fix, 'cause I have no idea.. |
Just to clarify, it doesn't matter what port number is passed. |
The call to UPDATE: UPDATE: Seems that UPDATE: Reason the
I'm open to ideas of the best way to get the call stack to flip over. |
@rmg So I've determined, mostly, why it's happening, but I'm not sure of the best fix. Thoughts? |
Cross linking to nodejs/node-v0.x-archive#14168. |
There's an easy "fix" (maybe "hack" is more appropriate): defer evaluation for a tick. diff --git a/src/node.js b/src/node.js
index cb50341..3a7e3c9 100644
--- a/src/node.js
+++ b/src/node.js
@@ -558,8 +558,10 @@
'return require("vm").runInThisContext(' +
JSON.stringify(body) + ', { filename: ' +
JSON.stringify(name) + ' });\n';
- var result = module._compile(script, name + '-wrapper');
- if (process._print_eval) console.log(result);
+ process.nextTick(function() {
+ var result = module._compile(script, name + '-wrapper');
+ if (process._print_eval) console.log(result);
+ });
}
function createWritableStdioStream(fd) { |
@bnoordhuis Nice. Want to handle the PR for that, or want me to? |
I'll file a PR, I don't think I've had a commit in for a while now. :-) |
Defer evaluation of the script for a tick. This is a workaround for events not firing when evaluating scripts on the command line with -e. Fixes: nodejs#1600
Fix: #1793 |
Defer evaluation of the script for a tick. This is a workaround for events not firing when evaluating scripts on the command line with -e. Fixes: nodejs#1600
Defer evaluation of the script for a tick. This is a workaround for events not firing when evaluating scripts on the command line with -e. Fixes: nodejs#1600 PR-URL: nodejs#1793 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Fixed by 93a44d5. |
Defer evaluation of the script for a tick. This is a workaround for events not firing when evaluating scripts on the command line with -e. Fixes: nodejs/node#1600 PR-URL: nodejs/node#1793 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Failing unit test submitted as PR #1581
I found this when trying to confirm the format of the address object. The following hangs on most releases of node higher than 0.10.38:
It seems that Server does not emit a listen event when no address is specified and is called in eval mode.
I don't fully understand how the regression was introduced, but
git bisect
seemed pretty confident that it was in 5b636fe./to @trevnorris for the indicated commit
/cc @piscisaureus @sam-github @brendanashworth
The text was updated successfully, but these errors were encountered: