ahoward / systemu

univeral capture of stdout and stderr and handling of child process pid for windows, *nix, etc.
Other
126 stars 33 forks source link

Ruby 3.0.0 compatability #52

Open ripienaar opened 3 years ago

ripienaar commented 3 years ago

This class modifies Process::Status at run time:

https://github.com/ahoward/systemu/blob/c910f79a46f739aee0b11e10a6158d8d3545501f/lib/systemu.rb#L108-L111

But in Ruby 3 that object is frozen and cannot be modified

https://bugs.ruby-lang.org/issues/17269

irb(main):001:0> RUBY_VERSION
=> "3.0.0"
irb(main):002:0> systemu("ls") {|cid| p cid}[0].thread
NoMethodError (undefined method `thread' for #<Process::Status: pid 17667 exit 0>)

pre 3.0.0 this did:

irb(main):002:0> RUBY_VERSION
=> "2.7.2"
irb(main):003:0> systemu("ls") {|cid| p cid}[0].thread
17922
=> #<Thread:0x0000000002552d58 /home/rip/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/systemu-2.6.5/lib/systemu.rb:134 dead>