1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

Fix broken YAML parsing on later Rubies with Psych >=4.0

YAML.load is now interpreted as YAML.safe_load, which breaks where the
YAML file contains aliases. If we can assume our yaml files are
trusted (since this a development tool), we can check for the presence
of YAML.unsafe_load and use it instead if it exists.
This commit is contained in:
Martyn Jago
2022-05-27 15:08:11 +01:00
parent e54c9787b7
commit b44c2dd095
6 changed files with 37 additions and 12 deletions

View File

@@ -4,11 +4,11 @@
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
require 'yaml'
require 'fileutils'
require_relative '../auto/unity_test_summary'
require_relative '../auto/generate_test_runner'
require_relative '../auto/colour_reporter'
require_relative '../auto/yaml_helper'
module RakefileHelpers
C_EXTENSION = '.c'.freeze
@@ -16,7 +16,7 @@ module RakefileHelpers
return if $configured
$cfg_file = "targets/#{config_file}" unless config_file =~ /[\\|\/]/
$cfg = YAML.load(File.read($cfg_file))
$cfg = YamlHelper.load_file($cfg_file)
$colour_output = false unless $cfg['colour']
$configured = true if config_file != DEFAULT_CONFIG_FILE
end