1 Without this patch functions such as process.getgroups
2 are not built on Android, which breaks things such as
3 npm/node_modules/which/which.js.
5 diff -u -r ../node-v4.0.0/src/node.cc ./src/node.cc
6 --- ../node-v4.0.0/src/node.cc 2015-09-08 11:30:45.000000000 -0400
7 +++ ./src/node.cc 2015-09-08 19:06:39.415724588 -0400
9 #include <unistd.h> // setuid, getuid
12 -#if defined(__POSIX__) && !defined(__ANDROID__)
13 +#if defined(__POSIX__)
14 #include <pwd.h> // getpwnam()
15 #include <grp.h> // getgrnam()
21 -#if defined(__POSIX__) && !defined(__ANDROID__)
22 +#if defined(__POSIX__)
24 static const uid_t uid_not_found = static_cast<uid_t>(-1);
25 static const gid_t gid_not_found = static_cast<gid_t>(-1);
30 -#endif // __POSIX__ && !defined(__ANDROID__)
34 void Exit(const FunctionCallbackInfo<Value>& args) {
37 env->SetMethod(process, "umask", Umask);
39 -#if defined(__POSIX__) && !defined(__ANDROID__)
40 +#if defined(__POSIX__)
41 env->SetMethod(process, "getuid", GetUid);
42 env->SetMethod(process, "geteuid", GetEUid);
43 env->SetMethod(process, "setuid", SetUid);
45 env->SetMethod(process, "getgroups", GetGroups);
46 env->SetMethod(process, "setgroups", SetGroups);
47 env->SetMethod(process, "initgroups", InitGroups);
48 -#endif // __POSIX__ && !defined(__ANDROID__)
51 env->SetMethod(process, "_kill", Kill);