Sha256: 2876b424a8848ab32a55f406d5118ec90c8884b563e9f7646822c3d5b3d95516
Contents?: true
Size: 831 Bytes
Versions: 19
Compression:
Stored size: 831 Bytes
Contents
# frozen_string_literal: true require 'open3' require 'bolt/node/output' module Bolt module Transport class Local class Shell def execute(*command, options) if options[:env] env = options[:env].each_with_object({}) { |(k, v), h| h["PT_#{k}"] = v.to_s } command = [env] + command end if options[:stdin] stdout, stderr, rc = Open3.capture3(*command, stdin_data: options[:stdin]) else stdout, stderr, rc = Open3.capture3(*command) end result_output = Bolt::Node::Output.new result_output.stdout << stdout unless stdout.nil? result_output.stderr << stderr unless stderr.nil? result_output.exit_code = rc.to_i result_output end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems