Sha256: 3c4efc126405ad473784ca276615b23354b9e6b10b9f565d360977726318210f

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'open3'

module Entangler
  module Executor
    module Background
      module Master
        protected

        def start_remote_slave
          logger.info('Starting - Entangler on remote')
          ignore_opts = @opts[:ignore].map { |regexp| "-i '#{regexp.inspect}'" }.join(' ')
          entangler_cmd = "entangler slave #{@opts[:remote_base_dir]} #{ignore_opts}"
          ssh_cmd = generate_ssh_command("source ~/.rvm/environments/default && #{entangler_cmd}")
          full_cmd = @opts[:remote_mode] ? ssh_cmd : entangler_cmd

          @remote_writer, @remote_reader, remote_err, @remote_thread = Open3.popen3(full_cmd)
          remote_err.close
        end

        def wait_for_threads
          super
          begin
            Process.wait @remote_thread[:pid]
          rescue StandardError
            nil
          end
        end

        def kill_off_threads
          Process.kill('INT', @remote_thread[:pid])
          super
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
entangler-1.2.3 lib/entangler/executor/background/master.rb
entangler-1.2.2 lib/entangler/executor/background/master.rb
entangler-1.2.1 lib/entangler/executor/background/master.rb
entangler-1.2.0 lib/entangler/executor/background/master.rb
entangler-1.1.2 lib/entangler/executor/background/master.rb