@@ -1687,23 +1687,21 @@ static const char* name_by_gid(gid_t gid) {
16871687#endif
16881688
16891689
1690- static uid_t uid_by_name (Handle<Value> value) {
1690+ static uid_t uid_by_name (Isolate* isolate, Handle<Value> value) {
16911691 if (value->IsUint32 ()) {
16921692 return static_cast <uid_t >(value->Uint32Value ());
16931693 } else {
1694- // TODO(trevnorris): Fix to not use GetCurrent().
1695- node::Utf8Value name (Isolate::GetCurrent (), value);
1694+ node::Utf8Value name (isolate, value);
16961695 return uid_by_name (*name);
16971696 }
16981697}
16991698
17001699
1701- static gid_t gid_by_name (Handle<Value> value) {
1700+ static gid_t gid_by_name (Isolate* isolate, Handle<Value> value) {
17021701 if (value->IsUint32 ()) {
17031702 return static_cast <gid_t >(value->Uint32Value ());
17041703 } else {
1705- // TODO(trevnorris): Fix to not use GetCurrent().
1706- node::Utf8Value name (Isolate::GetCurrent (), value);
1704+ node::Utf8Value name (isolate, value);
17071705 return gid_by_name (*name);
17081706 }
17091707}
@@ -1728,7 +1726,7 @@ static void SetGid(const FunctionCallbackInfo<Value>& args) {
17281726 return env->ThrowTypeError (" setgid argument must be a number or a string" );
17291727 }
17301728
1731- gid_t gid = gid_by_name (args[0 ]);
1729+ gid_t gid = gid_by_name (env-> isolate (), args[0 ]);
17321730
17331731 if (gid == gid_not_found) {
17341732 return env->ThrowError (" setgid group id does not exist" );
@@ -1747,7 +1745,7 @@ static void SetUid(const FunctionCallbackInfo<Value>& args) {
17471745 return env->ThrowTypeError (" setuid argument must be a number or a string" );
17481746 }
17491747
1750- uid_t uid = uid_by_name (args[0 ]);
1748+ uid_t uid = uid_by_name (env-> isolate (), args[0 ]);
17511749
17521750 if (uid == uid_not_found) {
17531751 return env->ThrowError (" setuid user id does not exist" );
@@ -1809,7 +1807,7 @@ static void SetGroups(const FunctionCallbackInfo<Value>& args) {
18091807 gid_t * groups = new gid_t [size];
18101808
18111809 for (size_t i = 0 ; i < size; i++) {
1812- gid_t gid = gid_by_name (groups_list->Get (i));
1810+ gid_t gid = gid_by_name (env-> isolate (), groups_list->Get (i));
18131811
18141812 if (gid == gid_not_found) {
18151813 delete[] groups;
@@ -1856,7 +1854,7 @@ static void InitGroups(const FunctionCallbackInfo<Value>& args) {
18561854 return env->ThrowError (" initgroups user not found" );
18571855 }
18581856
1859- extra_group = gid_by_name (args[1 ]);
1857+ extra_group = gid_by_name (env-> isolate (), args[1 ]);
18601858
18611859 if (extra_group == gid_not_found) {
18621860 if (must_free)
0 commit comments