lib/specinfra/command/base/file.rb in specinfra-2.14.3 vs lib/specinfra/command/base/file.rb in specinfra-2.14.4
- old
+ new
@@ -51,11 +51,11 @@
from ||= '1'
to ||= '$'
sed = "sed -n #{escape(from)},#{escape(to)}p #{escape(file)}"
sed += " | sed -n 1,#{escape(to)}p" if from != '1' and to != '$'
checker_with_regexp = check_contains_with_regexp("-", expected_pattern)
- checker_with_fixed = check_contains_with_fixed_strings("-", expected_pattern)
+ checker_with_fixed = check_contains_with_fixed_strings("-", expected_pattern)
"#{sed} | #{checker_with_regexp} || #{sed} | #{checker_with_fixed}"
end
def check_contains_lines(file, expected_lines, from=nil, to=nil)
require 'digest/md5'
@@ -83,10 +83,10 @@
def get_sha256sum(file)
"sha256sum #{escape(file)} | cut -d ' ' -f 1"
end
def get_content(file)
- "cat #{file} 2> /dev/null || echo -n"
+ "cat #{escape(file)} 2> /dev/null || echo -n"
end
def check_is_mounted(path)
regexp = "on #{path} "
"mount | grep -- '#{escape(regexp)}'"