mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove the Kernel#` override that turns ENOENT into nil
ActiveSupport overrides `` Kernel#` `` so that it would not raise `Errno::ENOENT` but return `nil` instead (due to the last statement `STDERR.puts` returning nil) if a given command were not found. Because of this, you cannot safely say somthing like `` `command`.chomp `` when ActiveSupport is loaded. It turns out that this is an outdated monkey patch for Windows platforms to emulate Unix behavior on an ancient version of Ruby, and it should be removed by now.
This commit is contained in:
parent
2312537867
commit
545b6e5820
3 changed files with 4 additions and 14 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
* Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems
|
||||||
|
|
||||||
|
*Akinori Musha*
|
||||||
|
|
||||||
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
||||||
|
|
||||||
`assoc` can now be called with either a string or a symbol.
|
`assoc` can now be called with either a string or a symbol.
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "active_support/core_ext/kernel/agnostics"
|
|
||||||
require "active_support/core_ext/kernel/concern"
|
require "active_support/core_ext/kernel/concern"
|
||||||
require "active_support/core_ext/kernel/reporting"
|
require "active_support/core_ext/kernel/reporting"
|
||||||
require "active_support/core_ext/kernel/singleton_class"
|
require "active_support/core_ext/kernel/singleton_class"
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Object
|
|
||||||
# Makes backticks behave (somewhat more) similarly on all platforms.
|
|
||||||
# On win32 `nonexistent_command` raises Errno::ENOENT; on Unix, the
|
|
||||||
# spawned shell prints a message to stderr and sets $?. We emulate
|
|
||||||
# Unix on the former but not the latter.
|
|
||||||
def `(command) #:nodoc:
|
|
||||||
super
|
|
||||||
rescue Errno::ENOENT => e
|
|
||||||
STDERR.puts "#$0: #{e}"
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue