Skip to content

Commit

Permalink
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions core/src/main/java/org/jruby/RubyProcess.java
Original file line number Diff line number Diff line change
@@ -830,28 +830,17 @@ public static IRubyObject uid(Ruby runtime) {
return runtime.newFixnum(checkErrno(runtime, runtime.getPosix().getuid()));
}

@Deprecated
public static IRubyObject waitpid2(IRubyObject recv, IRubyObject[] args) {
return waitpid2(recv.getRuntime(), args);
}
@JRubyMethod(name = "waitpid2", rest = true, module = true, visibility = PRIVATE)
public static IRubyObject waitpid2(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
return waitpid2(context.runtime, args);
}
public static IRubyObject waitpid2(Ruby runtime, IRubyObject[] args) {
int pid = -1;
int flags = 0;
if (args.length > 0) {
pid = (int)args[0].convertToInteger().getLongValue();
}
if (args.length > 1) {
flags = (int)args[1].convertToInteger().getLongValue();
}
IRubyObject pid = waitpid(context, recv, args);

int[] status = new int[1];
pid = checkErrno(runtime, runtime.getPosix().waitpid(pid, status, flags), ECHILD);
if (pid.isNil()) return pid;

return runtime.newArray(runtime.newFixnum(pid), RubyProcess.RubyStatus.newProcessStatus(runtime, status[0], pid));
return context.runtime.newArray(pid, context.getLastExitStatus());
}

public static IRubyObject waitpid2(Ruby runtime, IRubyObject[] args) {
return waitpid2(runtime.getCurrentContext(), runtime.getProcess(), args);
}

@JRubyMethod(name = "initgroups", required = 2, module = true, visibility = PRIVATE)
@@ -1346,4 +1335,9 @@ private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) {
throw runtime.newErrnoFromInt(runtime.getPosix().errno());
}
}

@Deprecated
public static IRubyObject waitpid2(IRubyObject recv, IRubyObject[] args) {
return waitpid2(recv.getRuntime(), args);
}
}

0 comments on commit 51aca9d

Please sign in to comment.