app/controllers/custom_script_hook_controller.rb
# Executes shell command. Returns true if the shell command exits with a success status code
Executes shell command. Returns true if the shell command exits with a success status code
Executes shell command . Returns true if the shell command exits with a success status code
def exec(command)
    logger.debug { "CustomScriptHook: Executing command: '#{command}'" }
    logfile = Tempfile.new('github_hook_exec')
    logfile.close
    success = system("#{command} > #{logfile.path} 2>&1")
    output_from_command = File.readlines(logfile.path)
    if success
      logger.debug { "CustomScriptHook: Command output: #{output_from_command.inspect}"}
    else
      logger.error { "CustomScriptHook: Command '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}"}
    end
    return success
  ensure
    logfile.unlink
  end
def exec ( command ) logger . debug { "CustomScriptHook: Executing command: '#{command}'" } logfile = Tempfile . new ( 'github_hook_exec' ) logfile . close success = system ( "#{command} > #{logfile.path} 2>&1" ) output_from_command = File . readlines ( logfile . path ) if success logger . debug { "CustomScriptHook: Command output: #{output_from_command.inspect}" } else logger . error { "CustomScriptHook: Command '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}" } end return success ensure logfile . unlink end
Executes shell command.
Executes shell command .
# Get a path to a temp file
command
<not_specific>