This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/src/main/java/org/jruby/RubyProcess.java b/core/src/main/java/org/jruby/RubyProcess.java | |
index 91006dd..e7622db 100644 | |
--- a/core/src/main/java/org/jruby/RubyProcess.java | |
+++ b/core/src/main/java/org/jruby/RubyProcess.java | |
@@ -573,7 +573,16 @@ public class RubyProcess { | |
@JRubyMethod(name = "groups", module = true, visibility = PRIVATE) | |
public static IRubyObject groups(IRubyObject recv) { | |
- throw recv.getRuntime().newNotImplementedError("Process#groups not yet implemented"); | |
+ if(Platform.IS_WINDOWS) { | |
+ throw recv.getRuntime().newNotImplementedError("groups() function is unimplemented on this machine"); | |
+ } else { | |
+ long[] groups = (new com.sun.security.auth.module.UnixSystem()).getGroups(); | |
+ RubyArray ary = RubyArray.newArray(recv.getRuntime(), groups.length); | |
+ for(int i = 0; i < groups.length; i++) { | |
+ ary.push(RubyFixnum.newFixnum(recv.getRuntime(), groups[i])); | |
+ } | |
+ return ary; | |
+ } | |
} | |
@JRubyMethod(name = "setrlimit", rest = true, module = true, visibility = PRIVATE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment