lib/specinfra/command/base.rb in specinfra-1.25.2 vs lib/specinfra/command/base.rb in specinfra-1.25.3
- old
+ new
@@ -166,12 +166,13 @@
def check_file_contain_within(file, expected_pattern, from=nil, to=nil)
from ||= '1'
to ||= '$'
sed = "sed -n #{escape(from)},#{escape(to)}p #{escape(file)}"
+ sed_end = "sed -n 1,#{escape(to)}p"
checker_with_regexp = check_file_contain_with_regexp("-", expected_pattern)
checker_with_fixed = check_file_contain_with_fixed_strings("-", expected_pattern)
- "#{sed} | #{checker_with_regexp} || #{sed} | #{checker_with_fixed}"
+ "#{sed} | #{sed_end} | #{checker_with_regexp} || #{sed} | #{sed_end} | #{checker_with_fixed}"
end
def check_file_contain_lines(file, expected_lines, from=nil, to=nil)
require 'digest/md5'
from ||= '1'