Merge pull request #40646 from vaporyhumo/patch-1

Fix `rails new` and `rails app:update` hanging on master bug.
This commit is contained in:
Rafael França 2020-11-27 11:50:10 -05:00 committed by GitHub
commit b13897fc01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,14 @@
require 'pathname'
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
exec "yarn", *ARGV
executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path|
normalized_path = File.expand_path(path)
normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn'))
end
exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV
rescue Errno::ENOENT
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"