Skip to content

Commit eed2884

Browse files
committed
fixup! fixup! src: use libuv to get env vars
1 parent e75c72e commit eed2884

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/node_env_var.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Local<Array> RealEnvStore::Enumerate(Isolate* isolate) const {
153153
CHECK_EQ(uv_os_environ(&items, &count), 0);
154154

155155
MaybeStackBuffer<Local<Value>, 256> env_v(count);
156+
int env_v_index = 0;
156157
for (int i = 0; i < count; i++) {
157158
#ifdef _WIN32
158159
// If the key starts with '=' it is a hidden environment variable.
@@ -166,10 +167,10 @@ Local<Array> RealEnvStore::Enumerate(Isolate* isolate) const {
166167
isolate->ThrowException(ERR_STRING_TOO_LONG(isolate));
167168
return Local<Array>();
168169
}
169-
env_v[i] = str.ToLocalChecked();
170+
env_v[env_v_index++] = str.ToLocalChecked();
170171
}
171172

172-
return Array::New(isolate, env_v.out(), env_v.length());
173+
return Array::New(isolate, env_v.out(), env_v_index);
173174
}
174175

175176
std::shared_ptr<KVStore> KVStore::Clone(v8::Isolate* isolate) const {

0 commit comments

Comments
 (0)