Permalink
Browse files

pass pid to RubyProcess::RubyStatus.new_process_status

* this method call is missing a third argument, pid
* this fix at least works on unix based systems
* closes #9
  • Loading branch information...
1 parent 5181b8a commit b5d60c37a9649ae7dd932fcece7c77109cce0d81 @cldwalker committed Mar 11, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/systemu.rb
View
@@ -173,7 +173,7 @@ def quietly
def child_program config
<<-program
# encoding: utf-8
-
+
PIPE = STDOUT.dup
begin
config = Marshal.load(IO.read('#{ config }'))
@@ -274,8 +274,11 @@ def systemu
end
exit_code = process.wait_for
+ field = process.get_class.get_declared_field("pid")
+ field.set_accessible(true)
+ pid = field.get(process)
[
- RubyProcess::RubyStatus.new_process_status(JRuby.runtime, exit_code),
+ RubyProcess::RubyStatus.new_process_status(JRuby.runtime, exit_code, pid),
stdout.join,
stderr.join
]

3 comments on commit b5d60c3

i would love another jruby person to comment on this: it's way outside my understanding. but i'm game to pull and release pending a review. i've asked @headius - https://twitter.com/#!/drawohara/status/179227185012420610

The pid-getting logic is hacky, but it's not an unreasonable hack. We do similar things inside JRuby proper.

The signature change looks like it happened earlier this year in response to JRUBY-5688. The construction method was never treated as a public API, so we just added the pid to it. So that's unfortunate, but it has been in the wild since April or so, and anyone using JRuby 1.6 updates will have had it in place since then.

We could add back the three-arg version, but I'm inclined to just leave it with only a four-arg version.

aye. everything about systemu is a hack: mostly around shitty process control on windoze ;-/ so i will pull, bump the version, and release. thanks jruby-heads.

Please sign in to comment.