Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

cares: Set process._errno, not global.errno #4933

Closed
wants to merge 1 commit into from

3 participants

isaacs Fedor Indutny Ben Noordhuis
isaacs
Owner

This makes test-internet pass

isaacs
Owner

@bnoordhuis Please review. I'm sure that there's a more lovely way to do this, but this at least makes the test pass.

isaacs
Owner

Vaguely related: There's some errno stuff in src/node_file.cc that seems extraneous as well. But it's not causing any tests to fail.

Fedor Indutny
Owner

We should probably export static process object from src/node.cc to node_internals.h and use it. Doing lookup in context's global doesn't feel like a right thing to me. And potentially unsafe.

This was referenced
Fedor Indutny
Owner

LGTM, landed in 74784b6

Fedor Indutny indutny closed this
Ben Noordhuis

Another (belated) LGTM.

Ben Noordhuis

Vaguely related: There's some errno stuff in src/node_file.cc that seems extraneous as well.

It's unused. Removed in 3dbbfd7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2013
  1. isaacs

    cares: Set process._errno, not global.errno

    isaacs authored
    This makes test-internet pass
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 4 deletions.
  1. +3 −3 src/cares_wrap.cc
  2. +3 −1 src/node.cc
  3. +3 −0  src/node_internals.h
6 src/cares_wrap.cc
View
@@ -261,9 +261,9 @@ static const char* AresErrnoString(int errorno) {
static void SetAresErrno(int errorno) {
HandleScope scope;
- Handle<Value> key = String::NewSymbol("errno");
- Handle<Value> value = String::NewSymbol(AresErrnoString(errorno));
- Context::GetCurrent()->Global()->Set(key, value);
+ Local<Value> key = String::NewSymbol("_errno");
+ Local<Value> value = String::NewSymbol(AresErrnoString(errorno));
+ node::process->Set(key, value);
}
4 src/node.cc
View
@@ -99,7 +99,9 @@ ngx_queue_t req_wrap_queue = { &req_wrap_queue, &req_wrap_queue };
Persistent<String> process_symbol;
Persistent<String> domain_symbol;
-static Persistent<Object> process;
+// declared in node_internals.h
+Persistent<Object> process;
+
static Persistent<Function> process_tickDomainCallback;
static Persistent<Function> process_tickFromSpinner;
static Persistent<Function> process_tickCallback;
3  src/node_internals.h
View
@@ -31,6 +31,9 @@ namespace node {
// Defined in node.cc
extern v8::Isolate* node_isolate;
+// Defined in node.cc at startup.
+extern v8::Persistent<v8::Object> process;
+
#ifdef _WIN32
// emulate snprintf() on windows, _snprintf() doesn't zero-terminate the buffer
// on overflow...
Something went wrong with that request. Please try again.