New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails makes Process::Status#to_json less useful #4857
Comments
|
This issue seems to be related to this file: activesupport/lib/active_support/core_ext/object/to_json.rb I am not sure how to fix this. The file is there for a reason, but breaking this functionality is not good either. |
|
This illustrates (closer to) the root cause: Which is defined here. |
|
... which I think is caused by this: |
|
... which is caused by this: ( |
|
So, Process::Status does not have any instance variables. So I'm not sure what the proper fix is. Theoretically, we could introduce a new core ext that would make fake instance variables for Process::Status, but that sounds really, really, really, really sketchy. |
|
Why not write a specific as_json for Process::Status? class Process::Status
def as_json; { :exitstatus => exitstatus, :pid => pid } end
end |
|
Ha, duh. I blame Russia. |
Hello,
Rails overrides Process::Status#to_json in a way that makes it less useful. For example, outside of Rails, Ruby 1.9.3 would report
#<Process::Status: pid 21661 exit 0>but inside Rails test environment it would report{}. See the complete demonstration below.Thanks for your consideration.
The text was updated successfully, but these errors were encountered: