Class: Braavos::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/braavos/command.rb

Defined Under Namespace

Classes: CommandError

Constant Summary collapse

NUMBER_OF_TRIES =
3

Instance Method Summary collapse

Instance Method Details

#execute(script, input) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/braavos/command.rb', line 8

def execute(script, input)
  script_tf = Tempfile.new('brav-cmd')
  script_tf.write(script)
  script_tf.close
  FileUtils.chmod("+rx", script_tf.path)

  execute_with_retry script, script_tf, input
ensure
  script_tf.unlink
end