Skip to content

Commit deb2273

Browse files
committed
bin/yaml-to-shell-vars: silently ignore missing or empty files
This prevents 'No such file or directory @ rb_sysopen' crashes when the script is invoked with empty strings or non-existent file arguments. Signed-off-by: Philip Li <philip.li@intel.com>
1 parent 6c3dc8d commit deb2273

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

bin/yaml-to-shell-vars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def shell_escape(v)
6060
end
6161

6262
ARGV.each do |file|
63+
next if file.nil? || file.empty? || !File.exist?(file)
64+
6365
vars = YAML.unsafe_load_file file
6466
unless vars
6567
warn "fail to load file #{file} which results in #{vars.inspect}"

0 commit comments

Comments
 (0)