Module: FreeBSD::Exec

Includes:
Beaker::CommandFactory
Included in:
Host
Defined in:
lib/beaker/host/freebsd/exec.rb

Instance Attribute Summary

Attributes included from Beaker::CommandFactory

#assertions

Instance Method Summary collapse

Methods included from Beaker::CommandFactory

#execute, #fail_test

Instance Method Details

#echo_to_file(str, filename) ⇒ Object



4
5
6
7
8
9
# File 'lib/beaker/host/freebsd/exec.rb', line 4

def echo_to_file(str, filename)
  # FreeBSD gets weird about special characters, we have to go a little OTT here
  escaped_str = str.gsub(/\t/, '\\t').gsub(/\n/, '\\n')

  exec(Beaker::Command.new("printf \"#{escaped_str}\" > #{filename}"))
end