require 'open4' require 'jenkins_util/logger_util' class CommandLineScript include LoggerUtil attr_reader :command, :pid, :stdin, :stdout, :sterr, :exit_status def initialize(command) @command = command LoggerUtil.log.debug("Executing: \"#{@command}\"") status = Open4.popen4(@command) do |pid, stdin, stdout, stderr| @pid = pid @stdin = stdin @stdout = stdout.readlines @error = stderr.readlines end @exit_status = status.exitstatus end end