Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support Process.spawn pgroup: true option #1894

Closed
paneq opened this Issue Sep 10, 2012 · 1 comment

Comments

Projects
None yet
2 participants

paneq commented Sep 10, 2012

irb(main):001:0> RUBY_VERSION
=> "1.9.3"

irb(main):002:0> Process.spawn("ls", :pgroup => true)
NoMethodError: undefined method `<' on true:TrueClass.
    from kernel/delta/kernel.rb:81:in `< (method_missing)'
    from kernel/common/process19.rb:76:in `adjust_options'
    from kernel/common/hash19.rb:243:in `each'
    from kernel/common/process19.rb:67:in `adjust_options'
    from kernel/common/process19.rb:31:in `extract_arguments'
    from kernel/common/process19.rb:284:in `spawn'
    from (irb):2
    from kernel/common/block_environment.rb:75:in `call_on_instance'
    from kernel/common/eval.rb:75:in `eval'
    from kernel/common/kernel19.rb:42:in `loop'
    from kernel/common/throw_catch19.rb:8:in `catch'
    from kernel/common/throw_catch.rb:10:in `register'
    from kernel/common/throw_catch19.rb:7:in `catch'
    from kernel/common/throw_catch19.rb:8:in `catch'
    from kernel/common/throw_catch.rb:10:in `register'
    from kernel/common/throw_catch19.rb:7:in `catch'
    from kernel/delta/codeloader.rb:68:in `load_script'
    from kernel/delta/codeloader.rb:110:in `load_script'
    from kernel/loader.rb:613:in `script'
    from kernel/loader.rb:816:in `main'

irb(main):003:0> Process.spawn("ls", :pgroup => 0)
=> 8590

From the doc: http://www.ruby-doc.org/core-1.9.3/Process.html#method-c-spawn

:pgroup => true or 0 : make a new process group

paneq commented Sep 10, 2012

I summon @LTe for help :)

@dbussink dbussink closed this in 848849d Sep 22, 2012

@roshats roshats added a commit to roshats/rubinius that referenced this issue Jun 26, 2014

@LTe @roshats LTe + roshats Change extract pgroup value
Cases:
1. pgroup value is 'true' => 0
2. pgroup value is kind of true => Rubinius will try coerce_to Integer
3. pgroup value if kind of true and pass coerce then Rubinius will check
check whether the value is < 0. If yes then an ArgumentError exception is thrown
4. pgroup if kind of false (false, nil) - default behavior (like without
pgroup)

Fixes #1894
2fc50ef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment